So i have 2 tables.
ITEM MASTER - With Fields ITEM CODE and PRODUCT_DESCRIPTION
ITEM_TYPE - With ITEM CODE and ITEM_TYPE_CODE
Types are Body, software, Accessory, Consumable , ect ect
Not all items in the Item master as a type_code only items sold in the last 2 years have a type code.
So i'm doing a Left join from the Item_Master to the Item_Type.
So now i want to "create" a new type 0 (as in Zero) = No Type assigned.
When i run my query the Items that does not have a type displays as Null in the field.
ITEM_TYPE.ITEM_TYPE_CODE
CASE
WHEN ITEM_TYPE.ITEM_TYPE_CODE [EDIT] --> IS NULL then 'No code assigned'
<--this still just returns a NULL
WHEN ITEM_TYPE.ITEM_TYPE_CODE = '1' then 'Body'
WHEN ITEM_TYPE.ITEM_TYPE_CODE = '2' then 'Lens'
WHEN ITEM_TYPE.ITEM_TYPE_CODE = '3' then 'Accesory'
WHEN ITEM_TYPE.ITEM_TYPE_CODE = '4' then 'Binoculars'
END as ITEM_TYPE_CODE
Ho do i get this right ?
Dont worry i got it right,
ITEM MASTER - With Fields ITEM CODE and PRODUCT_DESCRIPTION
ITEM_TYPE - With ITEM CODE and ITEM_TYPE_CODE
Types are Body, software, Accessory, Consumable , ect ect
Not all items in the Item master as a type_code only items sold in the last 2 years have a type code.
So i'm doing a Left join from the Item_Master to the Item_Type.
So now i want to "create" a new type 0 (as in Zero) = No Type assigned.
When i run my query the Items that does not have a type displays as Null in the field.
ITEM_TYPE.ITEM_TYPE_CODE
CASE
WHEN ITEM_TYPE.ITEM_TYPE_CODE [EDIT] --> IS NULL then 'No code assigned'
WHEN ITEM_TYPE.ITEM_TYPE_CODE = '1' then 'Body'
WHEN ITEM_TYPE.ITEM_TYPE_CODE = '2' then 'Lens'
WHEN ITEM_TYPE.ITEM_TYPE_CODE = '3' then 'Accesory'
WHEN ITEM_TYPE.ITEM_TYPE_CODE = '4' then 'Binoculars'
END as ITEM_TYPE_CODE
Ho do i get this right ?
Dont worry i got it right,
Last edited: