I have the following query that works when the Lookup table has something in it. However if “z.a” doesn’t equal anything the INSERT fails. Why would this be?
INSERT INTO dataTable(
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p
)SELECT
'000003',
COALESCE(z.Registration, 'REG6'),
'PFTEST',
'1',
'1',
'37000.0',
'148.0',
'439.8',
'1312475688',
'0',
'54',
COALESCE(z.TypeCode, 'A555'),
'',
'1173',
'0',
'nJ'
FROM
LookupTable z
WHERE
z.a = '000003'
In the end I removed the WHERE completely and performed selects within the VALUES direct. Works very well