I have a nested SQL
query, which broadly looks like below,
select distinct A.*, B.col1
from table1 A
left join table2 B
on <<something>>
where A.col1 = <<something>>
group by A.col3, A.col4
My understanding on the sequence of execution is as below
- Left join A & B on
<<something>>
- Subset resulting table from #1 based on
A.col1 = <<something>>
- Then execute group by
A.col3, A.col4
- Within each group from previous step get distinct combination of
A.*, B.col1
Could you please help if above understanding is correct?
What is the general rule for above such nested query?