I've been trying to set up a rather large query which has a select which should return a group_concat(inated) column which should contain exactly 4 concat(inated) results which are a result of a larger query.
I'll show the select to clear up any confusion (hopefully):
# Group the local category_feature_product.id, local feature value -
# and external feature value for the product together.
GROUP_CONCAT(
CONCAT(cfpt.category_feature_product_id, '||', pcfpt.category_feature_product_id, '||', cfpt.value, '||', pcfpt.value)
SEPARATOR ';'
) AS mysql_category_feature_products
I expect the query above to always return 4 results, may there be nulls in it or not, but it sometimes just only returns 3 or 2 results per group_concat. (i.e.: 273458||2658774||5
gets returned).
How can I assure that there is at least ALWAYS a null returned? I could show the large query if needed.
-- UPDATE --
Hereby the full query, a valid data example, actual result and the expected result as requested.
Full query:
I'm going to filter the results down to one product, since there are tens of thousands results. I will also only use the mysql_category_feature_products
column.
Actual result (Notice the last row):
Expected result (notice last row) & valid data example:
-- UPDATED (AGAIN) --
The actual expected reuslt for the last row is not 250258||2583482||null||6
BUT 250258||2583482||47||67
not null, my bad.
Rerunning the query with the new ifnull statement returns a different oucome for the last row: 250258||2583482||4
instead of 250258||2583482||6