Reputation:
I have two tables and have used a simple query:
SELECT * FROM innerb where not exists
(select * from wms where barcode = innerb.barcode) and pcode like '%102';
My results come out like this:
I need to add in a comma for all values so it looks like this:
But I don't want to update the table nor create a new table, just to add it in for few seconds.
Any ideas?
Upvotes: 0
Views: 827
Reputation: 1033
SELECT pcode || ',' as pcode
, brand || ',' as brand
FROM table
EDIT: Only works on some DBs. Apparently not MYSQL(unless you configure it to work). What does SQL Select symbol || mean? has a list of what works on which DB
Upvotes: 0
Reputation: 147146
You could create a view:
CREATE VIEW innerb_comma AS
SELECT CONCAT(Pcode, ',') AS Pcode,
CONCAT(Brand, ',') AS Brand,
CONCAT(Pdescription, ',') AS Pdescription,
CONCAT(Size, ',') AS Size,
CONCAT(Barcode, ',') AS Barcode
FROM innerb
WHERE NOT EXISTS (SELECT * FROM wms WHERE barcode = innerb.barcode)
AND Pcode like '%102';
Then select from that instead:
SELECT * FROM innerb_comma
Upvotes: 2