Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
magmo
Aged Yak Warrior
558 Posts |
Posted - 2013-02-07 : 06:51:56
|
HiI need to filter based on this query result...SELECT dbo.tbl_OrderInfo.IsFetchedFROM dbo.tbl_Customer INNER JOIN dbo.tbl_Login ON dbo.tbl_Customer.CustID = dbo.tbl_Login.CustID INNER JOIN dbo.tbl_OrderInfo ON dbo.tbl_Login.UID = dbo.tbl_OrderInfo.UserUniqueIDWHERE (dbo.tbl_Customer.CustID = 89) AND (dbo.tbl_OrderInfo.IsFetched = 0) OR (dbo.tbl_OrderInfo.IsFetched IS NULL) I need to update all dbo.tbl_OrderInfo.IsFetched and set them to dbo.tbl_OrderInfo.IsFetched = 1, how do change the code above? |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-07 : 06:59:14
|
[code]UPDATE dbo.tbl_OrderInfoSET dbo.tbl_OrderInfo.IsFetched = 1FROM dbo.tbl_Customer INNER JOIN dbo.tbl_Login ON dbo.tbl_Customer.CustID = dbo.tbl_Login.CustID INNER JOIN dbo.tbl_OrderInfo ON dbo.tbl_Login.UID = dbo.tbl_OrderInfo.UserUniqueIDWHERE (dbo.tbl_Customer.CustID = 89) AND (dbo.tbl_OrderInfo.IsFetched = 0) OR (dbo.tbl_OrderInfo.IsFetched IS NULL)[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-02-07 : 07:01:05
|
"I need to update all dbo.tbl_OrderInfo.IsFetched" <-- You mean all that are returned via the select query? If so:--SELECT dbo.tbl_OrderInfo.IsFetchedUPDATE dbo.tbl_OrderInfo SET IsFetched = 1FROM dbo.tbl_Customer INNER JOIN dbo.tbl_Login ON dbo.tbl_Customer.CustID = dbo.tbl_Login.CustID INNER JOIN dbo.tbl_OrderInfo ON dbo.tbl_Login.UID = dbo.tbl_OrderInfo.UserUniqueIDWHERE (dbo.tbl_Customer.CustID = 89) AND (dbo.tbl_OrderInfo.IsFetched = 0) OR (dbo.tbl_OrderInfo.IsFetched IS NULL) |
|
|
|
|
|