#1
  1. No Profile Picture
    Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Jan 2005
    Location
    Kent, UK
    Posts
    198
    Rep Power
    15

    Section of results


    I want to build a simple navigation for my site:

    I want to find 6 records from a table where the results are 3 from below the filter and 3 above it

    IE

    SELECT TOP (6) PictureID, ImgThumb
    FROM dbo.tblPictures
    WHERE (PictureID =1234) AND (OwnerID = 1)

    But it's not that simple, would I do that with row_count somehow and then use a sub query?
    Life is not a dress rehersal!

    My hobby:
    Photo4me.com
  2. #2
  3. 0x800A0C93
    ASP Super Hero (2500 - 2999 posts)

    Join Date
    Jan 2009
    Location
    Ridin' through this world...
    Posts
    2,975
    Rep Power
    1313
    What do you want?

    Do you want a recordset with pictures 1231, 1232, 1233, 1235, 1236, and 1237?

    It looks like pictureid is numeric.

    If that is the case you could try

    Code:
    SELECT TOP 3 PictureID, ImgThumb
    FROM dbo.tblPictures
    WHERE PictureID < 1234 AND OwnerID = 1
    order by pictureid desc
    UNION
    SELECT TOP 3 PictureID, ImgThumb
    FROM dbo.tblPictures
    WHERE PictureID > 1234 AND OwnerID = 1

    Comments on this post

    • nofriends agrees
    Brinkster- free development account. Not affiliated, but I sure like free. Brinkster.com

Similar Threads

  1. Need some advice on presenting query results
    By maniac4movie in forum ASP Development
    Replies: 4
    Last Post: November 23rd, 2006, 12:56 PM
  2. Exporting to excel is truncating results
    By twopecker in forum ASP Development
    Replies: 4
    Last Post: June 13th, 2005, 09:08 AM
  3. XMLHTTP Results Differences
    By Little Moe in forum ASP Development
    Replies: 8
    Last Post: June 1st, 2005, 06:04 PM
  4. search results
    By sug121 in forum ASP Development
    Replies: 0
    Last Post: January 23rd, 2005, 03:34 PM
  5. Transferring Query Results From One Form To Another
    By Rocco in forum Microsoft Access Help
    Replies: 4
    Last Post: September 2nd, 2004, 09:38 AM

IMN logo majestic logo threadwatch logo seochat tools logo