Reputation: 1
I have a table called "products" with around 500 products and i need to insert in the first 350 products for the description "Sample description" and for the other 150 products "sample 2 description".
How i can do that?
Many thanks!
Code:
UPDATE ps_product_lang SET description = CASE WHEN id_product <= 2124 THEN '<div style="line-height:24px;color:#000000;line-height:24px;">' ELSE '<div style="line-height:60px;color:#FFFFFF;line-height:28px;">' END
Upvotes: 0
Views: 69
Reputation: 838106
Assuming the first 350 products have ids from 1 to 350, you can try this:
UPDATE products
SET description = CASE
WHEN id <= 350 THEN 'Sample description'
ELSE 'sample description 2'
END
Upvotes: 2