When an item is set up in the master inventory file "itm_mstr" a corresponding record is automatically created in the file "loc_mstr". This automatically created record is the master location record. In order for the system to hold inventory amounts and ship an additional location record must be entered thru the system by a user. This means that there will be 2 location records for each item in the inventory master file. Please see below. Notice each item has the item number and then a "" (not null) for the first record (master location record) and then the second record is the location entry for that item "nj". What I am attempting to do is show the items that do not have a location entry assigned. I have linked the loc_mstr and the itm_mstr together hoping I can acheve a NULL to represent the fact that example: item 05555 does not have a location record of "nj" like the other items do. I just cant generate that null. Well, actually it does not have to be a null I just figured I could work with that.
If only the items that dont have a location assigned are generated that is okay too. I could work with that.
Any better ideas would be much appreciated.
Thanks
Code:
SELECT
case
when [COLOR=purple]Lm.LOCNCODE[/color] is null
then [COLOR=blue]Im.ITEMNMBR[/color]
else [COLOR=purple]Lm.LOCNCODE[/color]
end as location,
[COLOR=blue]Im.ITEMNMBR[/color] as item, [COLOR=purple]Lm.LOCNCODE[/color] as location
FROM [COLOR=blue]dbo.itm_mstr[/color] as [COLOR=blue]Im[/color] full outer JOIN
[COLOR=purple]dbo.loc_mstr[/color] as [COLOR=purple]Lm[/color] ON [COLOR=blue]Im.ITEMNMBR[/color] = [COLOR=purple]Lm.ITEMNMBR[/color]
Records from table "loc_mstr"
[tt]
item location
03202
03202 nj
04356
04356 nj
05555
06928
06928 nj
07233
07233 nj
[/tt]