SQL在单个查询中更新多行

时间:2011-02-13 06:37:23

标签: c# sql database ms-access

如果让我说我想在单个SQL查询中更新2行或更多行,我该怎么办呢?我目前的陈述不起作用如下:

UPDATE PricePlan SET Price='" + GuestInput.Text + "' WHERE PricePlanName = 'Guest' THEN Price='" + MemberInput.Text + "' WHERE PricePlanName = 'Member'

1 个答案:

答案 0 :(得分:2)

这样的东西应该有用......你需要稍微修改一下

"UPDATE PricePlan 
       SET price =
                 IIf(PricePlanName = 'Guest',"+ GuestInput.Text + ",
                   IIf(PricePlanName = 'Member',"+ MemberInput +"))"