I ran into a really strange problem today when using the MySQL function GROUP_CONCAT
:
I have the following query:
SELECT SUM(total) FROM order WHERE customer_id='X' AND order_status_id IN ((SELECT GROUP_CONCAT(order_status_id SEPARATOR ',') FROM order_status WHERE profit='1'))
but that returns NULLL, however:
SELECT SUM(total) FROM order WHERE customer_id='X' AND order_status_id IN (1,2,3,4,5,6,7,8)
this works as well as the first query to concat the status id's, grouped however they return NULL as total