SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
Jan 17, 2006, 10:14 #1
- Join Date
- Jan 2006
- Posts
- 169
- Mentioned
- 0 Post(s)
- Tagged
- 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:
link_id (key)
link_title
link_url
link_description
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.
Thanks,
Ken
-
Jan 17, 2006, 11:15 #2
Wrong forum, but..
Doing as 2 queries would be easier...
Code: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
Bookmarks