1

I have query like this

SELECT * 
FROM Tabel1
JOIN Table2 ON ...
JOIN 
    (SELECT * 
     FROM Table3 
     JOIN Table4 ON ....) as X ON Table2.Col1 = X.Col1

And my manager instructed me not use this and asked me to move the whole "X part to a #temp" table and make a join with #temp.

I can't understand what the problem with above code is ...

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • For the performance you must include your `DB` structure that u create. – Yogesh Sharma Feb 08 '18 at 05:10
  • Your manager said what? @yogesh is right, structure will greatly affect performance and any discussion about it... You would get a far more efficient query if you merged the two statements though, definitely avoid nested queries if you can, and with this partial example i think you can. – Chris Schaller Feb 08 '18 at 05:35
  • Thanks dude... I rewrote it with #table... – tamilselvan719 Feb 08 '18 at 06:38

0 Answers0