Bhuvan,
> An sql query results with 'n' records. OK.
> I need ONLY the 'n-1'th record.
You're making this much harder than it needs to be.
If you want the "nth" record, then you have to be supplying the database
with an ORDER BY. For the next-to-last record, simply reverse the ORDER
BY and take the second record.
e.g.:
If you want the next-to-last (n-1) record from:
SELECT * FROM syslog
ORDER BY entrytime;
Then ask for:
SELECT * FROM syslog
ORDER BY entrytime DESC
LIMIT 1 OFFSET 1;
Easy, no?
-Josh Berkus
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco