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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to skip the last record and output the second record an the rest 2

Status
Not open for further replies.

mperez5

Programmer
Nov 17, 2002
15
0
0
US
Hello All,
I need help in How to skip the last record and output the second record an the rest. I greatly appreaciate any help.
This is what I have so far:

SELECT my_id, name, lastName, my_date, myTitle
FROM myRecords
where myTitle='supervisor'
order by ReleaseDate desc limit 3


table name myRecords
my_id name lastName my_date myTitle
1 John Smith 2006-02-08 00:00:00 supervisor
2 Frank White 2006-02-02 00:00:00 supervisor
3 susan jones 2006-01-08 00:00:00 manager
4 jane webster 2006-01-02 00:00:00 supervisor
5 gina beck 2005-12-08 00:00:00 supervisor

Desire output
2 Frank White 2006-02-02 00:00:00 supervisor
4 jane webster 2006-01-02 00:00:00 supervisor
5 gina beck 2005-12-08 00:00:00 supervisor
 
LIMIT can take two arguments. Your requirement can be met if you use the two argument option.

Check out the online documentation at

Andrew
Hampshire, UK
 
could you please explain how you managed to skip not only the latest date (id 1) but also the third latest (id 3)

r937.com | rudy.ca
 
I got it, thanks towerbase and Guelphdad

SELECT my_id, name, lastName, my_date, myTitle
FROM myRecords
where myTitle='supervisor'
order by ReleaseDate desc limit 1, 3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top