update 和 select 是非常相似的,from 后面那段 sql 几乎是相同update CustomerTable set 某字段 = XX from dbo.CustomerTable,dbo.StudentBasic where CustomerTable.customerID = StudentBasic.customerID
update CustomerTable set 某字段 = XX from dbo.CustomerTable,dbo.StudentBasic where CustomerTable.customerID = StudentBasic.customerID
update table1 set column1=c.column1, column2=c.column2 from table1 a inner join table2 as c on c.Id=a.Id where a.Id=123
建议不要用where而用left join on进行两张表的联接。
这样不就可以更新两张表了,lz自己要发挥一下主观能动性update CustomerTable set 某字段 = XX from dbo.CustomerTable,dbo.StudentBasic where CustomerTable.customerID = StudentBasic.customerIDupdate StudentBasic set 某字段 = XX from dbo.CustomerTable,dbo.StudentBasic where CustomerTable.customerID = StudentBasic.customerID
from dbo.CustomerTable,dbo.StudentBasic
where CustomerTable.customerID = StudentBasic.customerID
column1=c.column1,
column2=c.column2
from table1 a inner join table2 as c
on c.Id=a.Id
where a.Id=123
where CustomerTable.customerID = StudentBasic.customerIDupdate StudentBasic set 某字段 = XX from dbo.CustomerTable,dbo.StudentBasic
where CustomerTable.customerID = StudentBasic.customerID
我用三层写的 你这样 我DAL层怎么写 汗 2句?
我天 dal里方法都是自己写的 没有说 非要对一个表进行操作啊
dal层不是和表一一对应的 不要把三层看的那么死。
同意3楼的看法
最好用SQL 事务 去