Syntax Error ORDER BY GROUP BY  | Familiar Sight | | Join Date: Jun 2008 Location: Europe
Posts: 128
| |
Hello, i need some help i am getting this error: - 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.location_id ORDER BY w.wine_id ASC' at line 1
the entire query code is: - SELECT
-
w.wine_id AS wineId,
-
w.name AS wineName,
-
w.producer_id AS producerId,
-
p.name AS producerName,
-
w.date_bottled AS dateBottled,
-
w.color_id AS colorId,
-
wc.name AS colorName,
-
w.type_id AS typeId,
-
wt.name AS typeName,
-
w.quality_guarantee_id AS qualityGuaranteeId,
-
wqg.name AS qualityGuaranteeName,
-
w.location_id AS locationId,
-
l.name AS locationName,
-
l.country_id AS countryId,
-
c.name AS countryName
-
FROM
-
Wine AS w
-
INNER JOIN Producer AS p ON (w.producer_id = p.producer_id)
-
INNER JOIN WineQualityGuarantee AS wqg ON (w.quality_guarantee_id = wqg.quality_guarantee_id)
-
INNER JOIN Location AS l ON (w.location_id = l.location_id)
-
INNER JOIN WineColor AS wc ON (w.color_id = wc.color_id)
-
INNER JOIN WineType AS wt ON (w.type_id = wt.type_id)
-
INNER JOIN Country AS c ON (l.country_id = c.country_id)
-
GROUP BY
-
w.location_id
-
ORDER BY
-
w.wine_id ASC
does any one have any suggestion?
thanks
bilibytes
|  | Site Moderator | | Join Date: May 2007 Location: New Hampshire
Posts: 2,565
| | | re: Syntax Error ORDER BY GROUP BY Quote:
Originally Posted by bilibytes Hello, i need some help i am getting this error: - 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.location_id ORDER BY w.wine_id ASC' at line 1
the entire query code is: - SELECT
-
w.wine_id AS wineId,
-
w.name AS wineName,
-
w.producer_id AS producerId,
-
p.name AS producerName,
-
w.date_bottled AS dateBottled,
-
w.color_id AS colorId,
-
wc.name AS colorName,
-
w.type_id AS typeId,
-
wt.name AS typeName,
-
w.quality_guarantee_id AS qualityGuaranteeId,
-
wqg.name AS qualityGuaranteeName,
-
w.location_id AS locationId,
-
l.name AS locationName,
-
l.country_id AS countryId,
-
c.name AS countryName
-
FROM
-
Wine AS w
-
INNER JOIN Producer AS p ON (w.producer_id = p.producer_id)
-
INNER JOIN WineQualityGuarantee AS wqg ON (w.quality_guarantee_id = wqg.quality_guarantee_id)
-
INNER JOIN Location AS l ON (w.location_id = l.location_id)
-
INNER JOIN WineColor AS wc ON (w.color_id = wc.color_id)
-
INNER JOIN WineType AS wt ON (w.type_id = wt.type_id)
-
INNER JOIN Country AS c ON (l.country_id = c.country_id)
-
GROUP BY
-
w.location_id
-
ORDER BY
-
w.wine_id ASC
does any one have any suggestion?
thanks
bilibytes Is this your query as it exists in your code? If so, where is the ";" that is supposed to end the mysql statement?
Regards,
Jeff
|  | Familiar Sight | | Join Date: Jun 2008 Location: Europe
Posts: 128
| | | re: Syntax Error ORDER BY GROUP BY
thanks for your answer, but the ';' is automatically appended to the query when using mysql_query() from php.
I already solved the problem.
Regards,
bilibytes
|  | Site Moderator | | Join Date: May 2007 Location: New Hampshire
Posts: 2,565
| | | re: Syntax Error ORDER BY GROUP BY Quote:
Originally Posted by bilibytes thanks for your answer, but the ';' is automatically appended to the query when using mysql_query() from php.
I already solved the problem.
Regards,
bilibytes Great! Congrats. Care to share the solution you discovered so we can all learn from it?
Thanks!
Jeff
|  | Similar MySQL Database bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,223 network members.
|