Bonjour à tous, je veux ordonner mes résultats suivants le nom de catégorie et mon sql ci-dessous me retourne une erreur
#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 'GROUP BY w_user_client . ID_CLIENT ORDER BY w_user_cat . NOM_CAT ASC
LIMIT 0, ' at line 1alors que si j'enleve le "group by" et le "order by" , il n'y a pas d'erreur.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 ( SELECT DISTINCT w_user_client.ID_CLIENT, w_user_client.NOM_CLIENT, w_user_client.MAIL_CLIENT, w_user_cat.NOM_CAT FROM w_user_client, w_user_cat WHERE w_user_client.ID_CAT=w_user_cat.ID_CAT AND w_user_cat.ID_CAT IN (10,11,12)) UNION ( SELECT DISTINCT w_user_client.ID_CLIENT, w_user_client.NOM_CLIENT, w_user_client.MAIL_CLIENT, w_user_cat.NOM_CAT FROM w_user_client, w_user_cat WHERE w_user_client.ID_CAT=w_user_cat.ID_CAT AND w_user_client.ID_USER ='1' AND w_user_cat.ID_CAT IN (1,2,6,9,7,3,4,5,8)) GROUP BY w_user_client.ID_CLIENT ORDER BY w_user_cat.NOM_CAT ASC
Voici le résultat sans le "group by" et le "order by":
Pourriez-vous m'aider? Merci d'avance.J'utilise MySQL 5ID_CLIENT NOM_CLIENT MAIL_CLIENT NOM_CAT
1 Client Test 1 client1@rmarketing.fr Abonnés
2 Client Test 2 client2@rmarketing.fr Abonnés
18 Client Test 123 client1@rmarketing.fr Sites internet relais
19 Client Test 3 client2@rmarketing.fr Sites internet relais
20 Client Test 3 client2@rmarketing.fr Agences de presse
22 Client Test 2 contact@rmarketing.fr Agences de presse
23 Client Test 2 client2@rmarketing.fr Sites internet relais
3 Client Test 6 jakarandha@yahoo.fr Sites internet relais
8 client test 8 client8@rmarketing.fr Abonnés
4 Ralita jacques.randria@gmail.com Sites internet relais
14 Bugs Bunny bugs.bunny@rmarketing.fr Sites internet relais
15 Daffy Duck daffy.duck@rmarketing.fr Sites internet relais
16 DASOpharma dasopharma@rmarketing.fr Agences de presse
17 ARMILIN jacques.randriamanantsoa@laposte.net Agences de presse
10 NORGIL aipus_ornis@yahoo.fr Abonnés
11 LAPOSTE laposte@rmarketing.fr Sites internet relais
9 Rakoto rakoto@rmarketing.fr Sites internet relais
7 Olivier Hauret ohauret@cofisem.fr Sites internet relais
13 Client Test 3 client2@rmarketing.fr Abonnés
24 Client Test 5 client9@rmarketing.fr Abonnés
26 test test@test.com Analyste financier
Partager