I'm trying NOT to create a temp table to do what I need because my 3rd party reporting software will require a stored procedure, and yet the 3rd party software has a bug preventing me to do so.
So, I was hoping to be able to do something like you see below. Is this possible? I'm definitely having trouble making a more complex version of this sample's structure work.
SELECT
ID,
NAME,
(SELECT TOP 1 TABLE1.TERM FROM TABLE1
WHERE TABLE1LTERM NOT IN
(SELECT DISTINCT TABLE2.TERM2 FROM TABLE2
WHERE TABLE2.TYPE <> 'XYZ')
AND TABLE1.DATE > '01/01/2015'
ORDER BY TABLE1.DATE)
So, I was hoping to be able to do something like you see below. Is this possible? I'm definitely having trouble making a more complex version of this sample's structure work.
SELECT
ID,
NAME,
(SELECT TOP 1 TABLE1.TERM FROM TABLE1
WHERE TABLE1LTERM NOT IN
(SELECT DISTINCT TABLE2.TERM2 FROM TABLE2
WHERE TABLE2.TYPE <> 'XYZ')
AND TABLE1.DATE > '01/01/2015'
ORDER BY TABLE1.DATE)