473,402 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Syntax Error ORDER BY GROUP BY

bilibytes
128 100+
Hello, i need some help i am getting this error:

Expand|Select|Wrap|Line Numbers
  1. You have an error in your SQL syntax;
  2.  check the manual that corresponds to your MySQL
  3.  server version for the right syntax to use near 
  4. 'GROUP BY w.location_id ORDER BY w.wine_id ASC' at line 1
the entire query code is:

Expand|Select|Wrap|Line Numbers
  1. SELECT
  2.             w.wine_id AS wineId,
  3.              w.name AS wineName,
  4.              w.producer_id AS producerId,
  5.              p.name AS producerName,
  6.              w.date_bottled AS dateBottled,
  7.              w.color_id AS colorId,
  8.              wc.name AS colorName,
  9.              w.type_id AS typeId,
  10.              wt.name AS typeName,
  11.              w.quality_guarantee_id AS qualityGuaranteeId,
  12.              wqg.name AS qualityGuaranteeName,
  13.              w.location_id AS locationId,
  14.              l.name AS locationName,
  15.              l.country_id AS countryId,
  16.              c.name AS countryName 
  17.         FROM 
  18.              Wine AS w 
  19.              INNER JOIN Producer AS p ON (w.producer_id = p.producer_id) 
  20.              INNER JOIN WineQualityGuarantee AS wqg ON (w.quality_guarantee_id = wqg.quality_guarantee_id) 
  21.              INNER JOIN Location AS l ON (w.location_id = l.location_id) 
  22.              INNER JOIN WineColor AS wc ON (w.color_id = wc.color_id) 
  23.             INNER JOIN WineType AS wt ON (w.type_id = wt.type_id) 
  24.             INNER JOIN Country AS c ON (l.country_id = c.country_id)
  25.         GROUP BY 
  26.             w.location_id 
  27.         ORDER BY 
  28.             w.wine_id ASC

does any one have any suggestion?

thanks

bilibytes
Jul 30 '09 #1
3 4029
numberwhun
3,509 Expert Mod 2GB
@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
Jul 31 '09 #2
bilibytes
128 100+
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
Aug 2 '09 #3
numberwhun
3,509 Expert Mod 2GB
@bilibytes
Great! Congrats. Care to share the solution you discovered so we can all learn from it?

Thanks!

Jeff
Aug 3 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
1
by: Paul | last post by:
Hi, I'm new to ASP and have stumbled across what appears to be a common problem, but after trying several solutions from other posts I've had no luck. My SQL SELECT statement is fine elsewhere...
4
by: Chris Kettenbach | last post by:
Hi Peter, I get error when processing the stylesheet. It errors here. <xsl:for-each select="registration)=1]"> specifically: Expression does not return a DOM node. registration)=1]<--
1
by: u473 | last post by:
I am scratching my head with the required quotes and parentheses. I started with an existing working Query with Running Total by date. Now I need to produce a running total by quarter day, so I...
4
by: Peter | last post by:
Hello, Thanks for reviewing my question. I am just starting out create a custom control following the KB example "Create a Data Bound ListView Control". I am receiving a syntax error on the...
1
by: Sandesh | last post by:
Hello All, Me saying " has any body come across such error would be underestimating". Well I am getting a very peculiar and unique error "Line 1: Incorrect syntax near 'Actions'." ...
2
by: Rshah | last post by:
sql query syntax? i write this query but error get : column not found how can i write ? SELECT c.stock_cat_name, a.stock_code, c.description, a.date, IIF(MID(a.type,2,1)="I",SUM(a.quantity),0)...
6
by: DBDriver | last post by:
I have an Access 97 database on WinXP with a linked Excel table of about 100,000 rows. I'm trying to construct a query that will give me an editable datasheet showing records where data in a pair...
1
by: jomurf | last post by:
Not sure if this is the right forum. I'm using Microsoft Query to get data from our ERP. However, every time I try to sum a column, I get a syntax error. Here's the sql statement: SELECT...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.