上面的語法的執行時的結果是一對多的關系﹐所以會出錯﹗﹗用循環來修改好了。For Up_Test In (Select Custom_Temp.Addr,Account.Cust_Id From Account,Custom_Temp Where Account.Cust_Id = Custom_Temp.Cust_Id) Loop Update Account Set Post_Addr = Up_Test.Addr Where Account.Cust_Id = Up_Test.Cust_Id; End Loop;Commit;
UPDATE titles SET ytd_sales = titles.ytd_sales + sales.qty FROM titles, sales WHERE titles.title_id = sales.title_id AND sales.ord_date = (SELECT MAX(sales.ord_date) FROM sales)这是我在SQLSERVER2000帮助里复制来的一段SQL,为什么它这样是对的,我上面的和他好象一样的呀,怎么不对,想不明白哦
update account set POST_ADDR=custom_temp.ADDR from account,custom_temp where account.CUST_ID=custom_temp.CUST_ID 同样语句我在SQLSERVER里面执行一下成功了(同样的表结构)
楼主你当oracle和sqlserver是一个爹娘养的呀?
哎,正因为我ORICAL刚学不大懂哦,各位大吓也请耐心了,不愿意回答的可以一笑而过啊
update account set post_addr=(select ADDR from custom_temp where account.CUST_ID=custom_temp.CUST_ID);
From Account,Custom_Temp
Where Account.Cust_Id = Custom_Temp.Cust_Id)
Loop
Update Account
Set Post_Addr = Up_Test.Addr
Where Account.Cust_Id = Up_Test.Cust_Id;
End Loop;Commit;
SET ytd_sales = titles.ytd_sales + sales.qty
FROM titles, sales
WHERE titles.title_id = sales.title_id
AND sales.ord_date = (SELECT MAX(sales.ord_date) FROM sales)这是我在SQLSERVER2000帮助里复制来的一段SQL,为什么它这样是对的,我上面的和他好象一样的呀,怎么不对,想不明白哦
set POST_ADDR=custom_temp.ADDR
from account,custom_temp
where account.CUST_ID=custom_temp.CUST_ID
同样语句我在SQLSERVER里面执行一下成功了(同样的表结构)