Jump to content


Photo

ERROR At GROUP_CONCAT


  • Please log in to reply
1 reply to this topic

#1 ricbax

ricbax
  • Members
  • PipPip
  • Member
  • 14 posts
  • LocationCanada

Posted 02 November 2005 - 04:16 PM

[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--]mysql> [span style=\'color:blue;font-weight:bold\']select[/span] * from repairs; +----+---------------------------------+------------------------------------------+
| id | cat_1 | cat_2 |
+----+---------------------------------+------------------------------------------+
| 1 | Renovation, Regular Maintenance | Air Conditioning Contractors and Systems |
| 2 | Repair | Air Conditioning Equipment-Repair |
| 3 | Regular Maintenance | Air Conditioning Systems-Cleaning |
+----+---------------------------------+------------------------------------------+
3 rows in set (0.00 sec)
mysql> [span style=\'color:blue;font-weight:bold\']INSERT[/span] INTO dynamic1 (cat_1, cat_2) VALUES (([span style=\'color:blue;font-weight:bold\']SELECT[/span] GROUP_CONCAT(cat_1) FROM repairs WHERE cat_2 IN ('Air Conditioning Contractors [span style=\'color:blue\']and Systems'[/span], 'Air Conditioning Equipment[span style=\'color:orange\']-Repair'[/span], 'Air Conditioning Systems[span style=\'color:orange\']-Cleaning'[/span])), 'Air Conditioning Contractors [span style=\'color:blue\']and Systems, Air Conditioning Equipment-Repair, Air Conditioning Systems-Cleaning'[/span]);
Query OK, 1 row affected (0.00 sec)

mysql> [span style=\'color:blue;font-weight:bold\']select[/span] * from dynamic1; +----+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------+
| id | cat_1 | cat_2 |
+----+-------------------------------------------[color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]+[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]+[/color]
| 4 | Renovation, Regular Maintenance,Repair,Regular Maintenance | Air Conditioning Contractors [color=blue]and[/color] Systems, Air Conditioning Equipment[color=orange]-[/color]Repair, Air Conditioning Systems[color=orange]-[/color]Cleaning |
[color=orange]+[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]+[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]+[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]-[/color][color=orange]+[/color]
1 row [color=green]in[/color] set (0.00 sec)
[!--sql2--][/div][!--sql3--]


[color=red]#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT GROUP_CONCAT(cat_1) FROM repairs WHERE cat_2 IN ('Air Co [/color]

I keep getting this error. I did get this query to work once but I forget what I did to get it to work ... please help.
phpfreaks.com and its users are great! - maybe one day I can be a phpfreak too!

#2 ricbax

ricbax
  • Members
  • PipPip
  • Member
  • 14 posts
  • LocationCanada

Posted 02 November 2005 - 05:56 PM

Is there an alternative to this function for MySQL 4.0 I realized that the GROUP_CONCAT () only works on MySQL 4.1 and above.
phpfreaks.com and its users are great! - maybe one day I can be a phpfreak too!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users