Re: finding next and prev record in mysql

2007-05-11 Thread Brent Baisley
clause. - Original Message - From: Richard Kurth [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Friday, May 11, 2007 1:15 AM Subject: finding next and prev record in mysql How would I find the next id and the prev id in sql statement like the one below. The id number is not going

Re: finding next and prev record in mysql

2007-05-11 Thread Mogens Melander
On Fri, May 11, 2007 07:15, Richard Kurth wrote: How would I find the next id and the prev id in sql statement like the one below. The id number is not going to be in order so I can't do a or limit 1 on the search SELECT id FROM contacts WHERE category = '5' AND subcategory = '1' AND

Re: finding next and prev record in mysql

2007-05-11 Thread Baron Schwartz
Hi, Richard Kurth wrote: How would I find the next id and the prev id in sql statement like the one below. The id number is not going to be in order so I can't do a or limit 1 on the search SELECT id FROM contacts WHERE category = '5' AND subcategory = '1' AND members_id= '8' ORDER BY

Re: finding next and prev record in mysql

2007-05-11 Thread Baron Schwartz
Mogens Melander wrote: On Fri, May 11, 2007 07:15, Richard Kurth wrote: How would I find the next id and the prev id in sql statement like the one below. The id number is not going to be in order so I can't do a or limit 1 on the search SELECT id FROM contacts WHERE category = '5' AND

RE: finding next and prev record in mysql

2007-05-11 Thread Richard Kurth
-Original Message- From: Baron Schwartz [mailto:[EMAIL PROTECTED] Sent: Friday, May 11, 2007 9:25 AM To: Mogens Melander Cc: mysql@lists.mysql.com Subject: Re: finding next and prev record in mysql Mogens Melander wrote: On Fri, May 11, 2007 07:15, Richard Kurth wrote: How would I

RE: finding next and prev record in mysql

2007-05-11 Thread Richard Kurth
limit 2,1 will give you the second record. It's the same query every time, you're just incrementing the first number of the limit clause. - Original Message - From: Richard Kurth [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Friday, May 11, 2007 1:15 AM Subject: finding next and prev record

Re: finding next and prev record in mysql

2007-05-11 Thread Baron Schwartz
Hi, Richard Kurth wrote: -Original Message- From: Baron Schwartz [mailto:[EMAIL PROTECTED] Sent: Friday, May 11, 2007 9:25 AM To: Mogens Melander Cc: mysql@lists.mysql.com Subject: Re: finding next and prev record in mysql Mogens Melander wrote: On Fri, May 11, 2007 07:15, Richard

finding next and prev record in mysql

2007-05-10 Thread Richard Kurth
How would I find the next id and the prev id in sql statement like the one below. The id number is not going to be in order so I can't do a or limit 1 on the search SELECT id FROM contacts WHERE category = '5' AND subcategory = '1' AND members_id= '8' ORDER BY lastname