Could anyone help me understand why I'm getting a syntax error when trying to run this query?
UPDATE exp_store_orders
SET exp_store_orders.order_status_name = "Digital"
JOIN exp_store_order_items
ON exp_store_orders.id = exp_store_order_items.order_id
JOIN exp_channel_data
ON exp_store_order_items.entry_id = exp_channel_data.entry_id
GROUP BY exp_store_order_items.order_id
HAVING COUNT(CASE exp_channel_data.field_id_50 WHEN '' THEN null ELSE 1 END) = COUNT(exp_store_order_items.order_id)
This brings up the ID's for the orders I'd like to update, but for some reason the above kicks back a syntax error.
SELECT exp_store_orders.id
FROM exp_store_orders
JOIN exp_store_order_items
ON exp_store_orders.id = exp_store_order_items.order_id
JOIN exp_channel_data
ON exp_store_order_items.entry_id = exp_channel_data.entry_id
GROUP BY exp_store_order_items.order_id
HAVING COUNT(CASE exp_channel_data.field_id_50 WHEN '' THEN null ELSE 1 END) = COUNT(exp_store_order_items.order_id)
Any help is appreciated, thanks!