0

If I have two table Orders and OrderDetails, what is the difference between two query?

select * from Orders o, OrderDetails d where o.OrderID = d.OrderID

and

select * from Orders o join OrderDetails d on o.OrderID = d.OrderID

Actually I get the same result but I want to know whether I can use the first query for inner join.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Nick Wan
  • 1
  • 2

1 Answers1

1

The on keyword evaluates the expression before the join, the where keyword evaluates the expression after the join.

HamishD
  • 349
  • 2
  • 15
  • Do you mean they are equivalent and using `on` will be more efficiently as it evaluates the expression before the join? – Nick Wan May 24 '18 at 08:04
  • @NickWan if you are just performing the query in your question, then yes there isn't a difference in the results – HamishD May 24 '18 at 08:05