Skip to content

Tag: group-concat

MySQL Query Returns Different Results

I’m having a strange problem with the following query: Sometimes I get zero, one, two or three results. I should always get three results. What could be causing this? Answer As pointed out by Solarflare, GROUP_CONCAT() could produce your team string in a random order, e.g. ‘Van Williams & Dere…

GROUP CONCAT and LEFT OUTER JOIN to split

I’m working with SQL Workbench. This is an example of the tables I have: I have not created this DB and can’t modify it. Each building corresponds to a site, so it contains a KEY to such site. Same with levels and buildings. I am trying to get this result the first two columns are easy, but I&#821…

Optimize GROUP_CONCAT in SQL on MySQL

Is there a way to get the following SQL optimized so it would run faster? I encountered the bottleneck are the GROUP_CONCAT’s but I couldn’t find a way by using an alternative or optimizing the query so it would run faster. At the moment the query needs about 3.2s on 2700 entries (mysql database 5…