I have two different tables, created by Load DATA commands,I am trying to run the following code:
select t.name as Name, sum(t.amount) as Total from
(select t2.name, t1.vendorname, t1.amount from bco_ifs_payment_data t1
join VendorName t2 on t1.vendorname like concat('%',t2.name,'%' )) as t
group by t.name;
The code works and returns rows when I use INSERT INTO command to insert data into the VendorName table , but when I use LOAD DATA command to insert data in the VendorName table no rows are returned in the JOIN even though same data is inserted in the table
THe Vendor_Names CSV has only one column. LOAD Data query is as following:
create Table vendorname(name nvarchar(100));
LOAD DATA LOCAL INFILE 'F:\Payments\_Global Payment\\Data\\Data\\Vendor_Names.csv'
INTO TABLE vendorname FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
update vendorname SET name = UPPER(name);
The INSERT query is as following:
INSERT INTO vendorname VALUES ('DELOITTE');
INSERT INTO vendorname VALUES ('CBRE');
Got it, had to include the following code: