Results 1 to 3 of 3

Thread: Order by issue

  1. #1
    Join Date
    May 2012
    Posts
    2

    Unanswered: Order by issue

    Hi all.

    Can anyone see my mistake here:

    Code:
    SELECT data.entry_id AS entry_id_f
                        FROM exp_channel_data AS data 
                        WHERE field_id_73 = 'yes' 
                        LIMIT 0, 1
                        ORDER BY 1 DESC
    It keeps showing an error of:

    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 'ORDER BY 1 DESC' at line 1

    and I cant find the issue.

    Thank you

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    if you look up the syntax in da manual, you will see that ORDER BY is optional, and so is LIMIT, but if you use them both, guess which one has to come first?

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    May 2012
    Posts
    2
    Ah I see. Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •