2012年3月15日 星期四

如何在Mysql裡面使用update+join

就用一個例子說明:
update TABLE1 inner join TABLE2 on  TABLE1.FIELD1 = TABLE2.FIELD1  set TABLE1.FIELD2  = concat( TABLE1.FIELD2 ,'xxx') where  TABLE2.FIELD3  < '2011-09-27'

跟MSSQL不同的是它的join子句就寫在update的後面,取代原來update後面的table,這樣比MSSQL似乎更直覺了些~~