我想获取以下查询的结果,并对NAME_UD_AFFILIATIONS执行更新,并将Member_Status字段设置为N.
我正在使用SQL Server Management Studio 2005 Ver。 Windows 7上的9.0
SELECT *
FROM NAME
INNER JOIN Name_UD_Affiliations ON NAME.ID=Name_UD_Affiliations.ID
WHERE
NAME_UD_AFFILIATIONS.Member_Status='R' and
Name.Join_Date > '2012-9-1' and
Name.Paid_Thru > '2013-09-01'
答案 0 :(得分:5)
使用SQL-Server可以做到
UPDATE Name_UD_Affiliations
SET Member_Status = 'N'
FROM NAME
INNER JOIN Name_UD_Affiliations ON NAME.ID=Name_UD_Affiliations.ID
WHERE NAME_UD_AFFILIATIONS.Member_Status='R'
AND Name.Join_Date > '2012-9-1'
AND Name.Paid_Thru > '2013-09-01'