[citation order corrected] >>> i'm searching for a solution, getting the last 10 records of a >>> database. I've got a table with timestamps and corresponding values. >>> >>> SELECT ts,value FROM table WHERE rowno <= COUNT(*)-10''; doesn't >>> work, >>> can sb help me plz? >> You could use >> select ts,value from table order by ts desc >> and fetch only the first n rows.
> this isn't the solution, because first the records are selected und > afterwards they get ordererd and not the way around. Your > solution would > pick the first 10 records with descending order. No. It selects the records with the highes timestamps first. If your application fetches the first ten rows, then you have the "last ten records". Provided, the field ts really holds the timestamp when the INSERT has happened. Admitted, the rows returned are in descending order, but your application is capable of re-sorting ten rows, isn't it? HTH & best regards Christian -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
