#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    78
    Rep Power
    12

    Question Any idea how to do these kind of queries? Possible?


    row -- value
    5 -- 3445
    8 -- 6557
    98 -- 8533
    32 -- 6594
    675 -- 98k

    Hi. Is it possible to do the following:
    If i were to select row 8, i would also like ,row 5 and row 98 to be selected?

    if i were to select row 98, row 8 and row 32 will be selected?

    Pls advise. Thanks.
  2. #2
  3. Introspective
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Nov 2001
    Location
    London, UK
    Posts
    3,317
    Rep Power
    110
    I don't know of a way of doing that actually. I don't think you can refer specifically to the position of a record, unless you have a totally reliable sequence, wich you could combine with a LIMIT statement.

    So quick answer - select them all and do the manipulation in whatever your application language is.. php perl etc.

    christo
    This is me: http://chris.uk.com
  4. #3
  5. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,120
    Rep Power
    4274
    fused, you can do it, however you have to have some way of sequencing the rows into exactly that order

    obviously, they are not in "row" sequence, and they are also not in "value" sequence, so you would have to declare another column to sequence them by, and then you could use that column to retrieve the "prev/next" rows

    see Move Backward through a Table

    rudy

IMN logo majestic logo threadwatch logo seochat tools logo