I am trying to load a file. I get the file to load but the category_id and supplier id load blank entries. Can someone tell me what I am doing wrong in the statement below.
LOAD DATA INFILE 'c:/inventory.csv' INTO TABLE pos.items
fields terminated by ',' IGNORE 1 LINES
(@a,@b,ITEM_NAME,@f,@c,DEPOSIT,@g,supplier_catalogue_number,Model,SERIAL_NUMBER,@d,@e)
set
category_id=(SELECT id as aa FROM `pos`.`categories` where category like '%@a%'),
brand_id = 1,
supplier_id = (SELECT id FROM suppliers where supplier like '%@e%'),
quantity = 0,
tax_percent = 0,
total_cost =@g * 1,
buy_price = 0,
unit_price = @g
;
LOAD DATA INFILE 'c:/inventory.csv' INTO TABLE pos.items
fields terminated by ',' IGNORE 1 LINES
(@a,@b,ITEM_NAME,@f,@c,DEPOSIT,@g,supplier_catalogue_number,Model,SERIAL_NUMBER,@d,@e)
set
category_id=(SELECT id as aa FROM `pos`.`categories` where category like '%@a%'),
brand_id = 1,
supplier_id = (SELECT id FROM suppliers where supplier like '%@e%'),
quantity = 0,
tax_percent = 0,
total_cost =@g * 1,
buy_price = 0,
unit_price = @g
;