Can someone please help me with this...
I am trying to write an SQL statement for the following:
If REC_TYPE = '02' and LOT_NBR is null, look for
REC_TYPE = '03' with same DLVRY_KEY as REC_TYPE = '02' and load those records.
If there is no REC_TYPE = '03' for a particular DLVRY_KEY,
load REC_TYPE = '02' records for that same DLVRY_KEY.
DLVRY_KEY REC_TYPE LOT_NBR
____________________________
001 02 null
001 03 abc
001 03 efg
I tried the where exists, but that didn't help...any suggestions?
I am trying to write an SQL statement for the following:
If REC_TYPE = '02' and LOT_NBR is null, look for
REC_TYPE = '03' with same DLVRY_KEY as REC_TYPE = '02' and load those records.
If there is no REC_TYPE = '03' for a particular DLVRY_KEY,
load REC_TYPE = '02' records for that same DLVRY_KEY.
DLVRY_KEY REC_TYPE LOT_NBR
____________________________
001 02 null
001 03 abc
001 03 efg
I tried the where exists, but that didn't help...any suggestions?