SqlServer2005 下可以
update
A
set A.c_limitDate=B.ReplyDeadline from (SELECT *
FROM visit_entries AS b
WHERE (SELECT COUNT(*) FROM visit_entries WHERE code=b.code)=1 )B
inner join (SELECT *
FROM hdzx_question as a
WHERE (SELECT COUNT(*) FROM hdzx_question WHERE c_qusno=a.c_qusno)=1
)A on B.code=A.c_qusno and A.c_limitDate is null and A.c_qusStatus=4
以下是对应的2000:
update
A
set A.c_limitDate=B.ReplyDeadline from (SELECT *
FROM visit_entries AS b
WHERE (SELECT COUNT(*) FROM visit_entries WHERE code=b.code)=1 )B
inner join hdzx_question as A on B.code=A.c_qusno and A.c_limitDate is null and A.c_qusStatus=4