Single Line Mysql If Statement
I would like to use this code on phpmyadmin but always get an error message:
SELECT IF ( NOT EXISTS ( SELECT *
FROM otthonfenyei_hu_beta_pos.global_products
WHERE product_manufacturer = 'Apollo'
AND product_art_num = 'SUP-50-GRAY' ) )
BEGIN INSERT INTO otthonfenyei_hu_beta_pos.global_products
(global_product_id, product_barcode, product_art_num,
product_name, product_desc, product_manufacturer,
product_vtsz, product_unit_type, product_list_price,
product_list_price_date)
VALUES (null, '5905949002762', 'SUP-50-GRAY', 'Hajszárító
Linea Piccola', '1200W, összecsukható fogantyú, szûkítõ,
gumírozott markolat. Túlmelegedés elleni védelem, 2 állású
teljesítmény kapcsoló. Szín: Szürke', 'Apollo', '', 'db',
'1499', '2011-02-02 00:00:00')
ELSE BEGIN UPDATE otthonfenyei_hu_beta_pos.global_products
SET product_barcode='5905949002762',
product_name='Hajszárító Linea Piccola',
product_desc='1200W, összecsukható fogantyú,
szûkítõ, gumírozott markolat. Túlmelegedés elleni
védelem, 2 állású teljesítmény kapcsoló. Szín:
Szürke',`product_vtsz`='',
product_unit_type='db',
product_list_price='1499',
product_list_price_date='2011-02-02 00:00:00'
WHERE product_manufacturer = 'Apollo'
AND product_art_num = 'SUP-50-GRAY'
END;
Error:
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ') BEGIN INSERT INTO `otthonfenyei_hu_beta_pos`.`global_products`
(`global_produc' at line 1
No comments:
Post a Comment