SQL Apprentice Question
On the below, I'm trying to inner join on 2 fields.
stcdl.od = 'AZDB1234'
itk.od = '1234'
SET itk.ta = stcdl.ta
INNER JOIN stcdl ON SubString(stcdl.od,5,4) = itk.od
Obviously, what I'm trying to do does not work.
What will work?
Let's try the Standard SQL syntax instead of the unpredictable
proprietary T-SQL syntax:
= (SELECT stcdl.ta
WHERE SUBSTRING (stcdl.od, 5, 4) = itk.od);
If the scalar subquery returns nothing, you will get a NULL assigned.
If the scalar subquery returns more than one row , you will get a