I want to know whether there are any consequences of having sub queries within a select statement so for example writing queries using this style.
CONVERT(VARCHAR(10), (SELECT PROFILEDATE FROM tblTable WHERE ProfileID= tst.[ID] AND [ProfileDate]=(SELECT MAX([ProfileDate]) FROM [EtpForecastDividendsStaging] WHERE [ProfileID]=qry.[ProfileID] AND [ProfileDate]<qry.[ProfileDate])), 120)
CONVERT(VARCHAR(10), (SELECT MAX([ProfileDate]) FROM tbltable WHERE [ProfileID]=qry.[ProfileID] AND [ProfileDate]<qry.[ProfileDate]), 120)
The above example is just a sample and not a query i had expect to compile, i am just using it as an illustration.
I believe its bad programming, but i may be wrong. I tend to like normal traditional joins where you select the column and join based on the corresponding keys, but I am trying to grasp some justification for my approach.
View Complete Post