Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting last 12 records

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
I am trying to get just the last 12 records from a table.
I have tried this but get no results.

Code:
SELECT TITLE, ARTIST, STYLE, MEDIUM, FORMAT, CATEGORY, WIDTH, HEIGHT, SPRICE, FILENAME, NUM FROM PICTURES WHERE CUSNUM='YES' AND ARTALLOW<>'NO' ORDER BY DESC LIMIT 12

Could someone please show me the correct method?


Keith
 
... the last 12 records ...
last regarding what ?

you have to submit some column name here:
... ORDER BY <column> DESC LIMIT 12

hope this helps
 
I'm suprised you haven't reported an error. The query is not well-formed.

I particular, the ORDER BY clause:

ORDER BY DESC LIMIT 12

is missing the name of the column by which the results will be ordered. It should read:

ORDER BY SomeTableColumnName DESC LIMIT 12



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top