Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all


Can any one explain the sql query how this will execute
means which join will done first on which condition.

SQL
SELECT DISTINCT P.TITLE ,P.PROJECT_ID FROM PROJECT_MEMBER PM 
INNER JOIN PROJECT P ON PM.PROJECT_ID = P.PROJECT_ID
LEFT JOIN PROJECT_LEAD_MAPPING PLM ON PLM.FK_PROJECT_ID = P.PROJECT_ID AND PLM.IS_ACTIVE = 1
WHERE ((PM.MEMBER_ID = 1) OR (PLM.LEADER_ID = 1))
AND P.STATUS = 4
AND PM.START_DATE <= '2012-4-17' AND PM.END_DATE > '2012-4-17'

Please Help

Thanks in advance
Posted
Updated 17-Apr-12 3:25am
v3

The query processor in any modern RDBMS will try to optimize the order of execution and this will depend on how much data and what indexes have been defined.

So it is very difficult if not impossible to tell you this without asking the execution plan from the server processing the query.
 
Share this answer
 
Comments
Abhinav S 17-Apr-12 9:25am    
%!
bhagirathimfs 17-Apr-12 9:27am    
Sry didn't get "%!"
Mehdi Gholam 17-Apr-12 9:42am    
Thanks %! :)
bhagirathimfs 17-Apr-12 10:42am    
:)
bhagirathimfs 17-Apr-12 9:27am    
Actually i want to know how this will execute.
Means:1st the inner join will executed with the condition given in the on cluse
or the left outer join will execute first .
Like this how the above query will execute ?
SQL

 
Share this answer
 
v3
Comments
member60 18-Apr-12 2:22am    
what is this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900