Results 1 to 2 of 2
Jan 17, 2006, 09:14 #1
- Join Date
- Jan 2006
- 0 Post(s)
- 0 Thread(s)
Any mysql wizards want to give this one a try? I'm stumped.
I'm usually pretty good a writing mysql queries, but this one has me stumped... I have a large database of links that has the following fields:
I want to pass a link with a specific link_id and have the query return an alphabetized list (based on link_title) of links with 12 links before and 12 links after the link I pass.
Jan 17, 2006, 10:15 #2
Wrong forum, but..
Doing as 2 queries would be easier...
SELECT p.* FROM INNER JOIN links p ON p.title < l.title WHERE l.linkId = :linkId ORDER BY l.title DESC LIMIT 12 SELECT f.* FROM INNER JOIN links p ON f.title > l.title WHERE l.linkId = :linkId ORDER BY l.title ASC LIMIT 12