GROUP_CONCAT comma separator – MySQL

I have a query where I am using GROUP_CONCAT and a custom separator as my results may contain commas: ‘—-‘ This all works well, however it is still comma separated, so my output is: How can I make it so the output is: I thought this was the idea of a custom separator! Failing that, … Read more

MySQL LIKE IN()?

A REGEXP might be more efficient, but you’d have to benchmark it to be sure, e.g.

SUM OVER PARTITION BY

You could have used DISTINCT or just remove the PARTITION BY portions and use GROUP BY: Not sure why you are dividing the total by the count per BrandID, if that’s a mistake and you want percent of total then reverse those bits above to: