Dilip February 2016

Joining two tables. Which SQL is right?

I am trying to check whether DAY values are stored at Sales ID level. They are in two different tables. I have created two different queries. Could someone tell me which one is right.

select S.sales_id,count(D.ID) from 
  W_SALES_ORDER_LINE_F S,
   W_DAY_D D
    where 
  D.ID = S.SCHEDULE_ID
    group by S.sales_id ;

OR

 select S.sales_id,count(D.ID) from 
  W_SALES_ORDER_LINE_F S join
   W_DAY_D D
    on 
  D.ID = S.SCHEDULE_ID
    group by S.sales_id ;

I am trying to improve the performance. So I want to know based on their performances and runtime etc.

Answers


Dave February 2016

Both queries will yield the same results.


Joe Stefanelli February 2016

Both are equivalent, but the latter query is preferable as it conforms to the newer ANSI-92 SQL standard.

Post Status

Asked in February 2016
Viewed 3,507 times
Voted 9
Answered 2 times

Search




Leave an answer