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 |
Namagiri
Starting Member
5 Posts |
Posted - 2013-03-25 : 12:21:59
|
UPDATE OD SET discount += 0.05FROM dbo.OrderDetails AS OD JOIN dbo.Orders AS O ON OD.orderid= O.orderidWHERE O.custid= 1;UPDATE OD SET discount += 0.05FROM dbo.OrderDetails AS OD JOIN dbo.Orders AS O ON OD.orderid= O.orderidand O.custid= 1;Thanks |
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2013-03-25 : 12:41:53
|
They look similar , in terms of the resultset you'll see. Althougfh the syntax is different i.e WHERE versus = . Jack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2013-03-25 : 13:09:38
|
In the first query, you are using a WHERE clause to apply the predicate "O.custid= 1." Where as, with the second query, you are applying the predicate on the join clause. For an INNER JOIN there isn't a difference in the result set. However, if you do an OUTER join, where you apply the predicate can make a difference in the result set. |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
|
Namagiri
Starting Member
5 Posts |
Posted - 2013-03-26 : 15:28:57
|
Thanks everyone. Thanks bandi for the links. |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-03-27 : 01:16:14
|
quote: Originally posted by Namagiri Thanks everyone. Thanks bandi for the links.
Welcome--Chandu |
|
|
|
|
|