Welcome to Dream.In.Code
Getting Help is Easy!

Join 105,412 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,753 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Syntax error in query expression

 
Reply to this topicStart new topic

Syntax error in query expression

katypla
post 28 Apr, 2008 - 08:38 AM
Post #1


New D.I.C Head

*
Joined: 28 Apr, 2008
Posts: 0

I have the following error when I try to use the LIMIT clause in my SQL expression:
Syntax error (missing operator) in query expression 'vins_nom LIMIT 1'
If I donīt use "LIMIT 1" itīs ok.

CODE
    
SQLStmt = "SELECT vins_id, vins_nom, vins_desc, vins_photo, villages_nom, domaines_nom, appelations_nom, couleurs_nom, millesimes_nom, cepages_nom, vins_btmin, vins_bouteille, vins_prix1, vins_coupcoeur FROM (((((vins LEFT JOIN villages ON vins.villages_id=villages.villages_id ) LEFT JOIN domaines ON vins.domaines_id=domaines.domaines_id) LEFT JOIN appelations ON vins.appelations_id=appelations.appelations_id) LEFT JOIN couleurs ON vins.couleurs_id=couleurs.couleurs_id) LEFT JOIN millesimes ON vins.millesimes_id=millesimes.millesimes_id) LEFT JOIN cepages ON vins.cepages_id=cepages.cepages_id"
    SQLStmt &= " WHERE TRIM(vins.vins_coupcoeur) <> ''"
    SQLStmt &= " AND vins.vins_site "
    SQLStmt &= " ORDER BY vins_nom LIMIT 1"


Thank for your help.
User is offlineProfile CardPM

Go to the top of the page


skyhawk133
post 28 Apr, 2008 - 08:43 AM
Post #2


Head DIC Head

Group Icon
Joined: 17 Mar, 2001
Posts: 14,362



Thanked 33 times

Dream Kudos: 1600

Expert In: Web Development

My Contributions


MySQL or MSSQL?
User is offlineProfile CardPM

Go to the top of the page

ultimitloozer
post 28 Jun, 2008 - 08:53 PM
Post #3


New D.I.C Head

*
Joined: 27 Jun, 2008
Posts: 6



Thanked 1 times
My Contributions


How about using the TOP clause instead of the LIMIT sub-clause? Just remove the LIMIT 1 from the end of the statement and begin the select like this:

CODE
SELECT TOP 1 ...


It should resolve your problem and give you the same results you are looking for.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/20/08 05:35AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month