Jump to content

Recommended Posts

[!--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 |

+----+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------+

| 4 | Renovation, Regular Maintenance,Repair,Regular Maintenance | Air Conditioning Contractors and Systems, Air Conditioning Equipment-Repair, Air Conditioning Systems-Cleaning |

+----+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------+

1 row in set (0.00 sec)

[!--sql2--][/div][!--sql3--]

 

 

#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

 

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.

Link to comment
https://forums.phpfreaks.com/topic/2785-error-at-group_concat/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.