Professional Web Applications Themes

Find records either side of the record found - MySQL

I need to search a table and find a specific record. This I can do, altho I then need to find 49 people either side of this record when ordered by rank. I.e I have loads of people who are ranked. Want to choose a player and then find the people either side of that player....

  1. #1

    Default Find records either side of the record found

    I need to search a table and find a specific record. This I can do,
    altho I then need to find 49 people either side of this record when
    ordered by rank.

    I.e I have loads of people who are ranked. Want to choose a player and
    then find the people either side of that player.

    Iain Guest

  2. #2

    Default Re: Find records either side of the record found

    > I need to search a table and find a specific record. This I can do, 

    Sounds like a job for the HANDLER statement:

    http://dev.mysql.com/doc/refman/5.1/en/handler.html

    Best regards,
    --
    Willem Bogaerts

    Application smith
    Kratz B.V.
    http://www.kratz.nl/
    Willem Guest

  3. #3

    Default Re: Find records either side of the record found

    On Jun 15, 1:21 pm, Willem Bogaerts
    <maardanzonderditstuk.nl> wrote: 

    >
    > Sounds like a job for the HANDLER statement:
    >
    > http://dev.mysql.com/doc/refman/5.1/en/handler.html
    >
    > Best regards,
    > --
    > Willem Bogaerts
    >
    > Application smith
    > Kratz B.V.http://www.kratz.nl/[/ref]

    I never even heard of the HANDLER! Definitely looks worth getting
    into...
    A long, long time ago I had a stab at doing something this, using a
    bit of php to determine the limits.
    My solution varied the resultset according to where in the overall
    rankings the specified row appeared, so if the top ranked row was
    selected it would show that and n succeeding rows, the bottom ranked
    row would show n preceeding values, and a row somewhere in the middle
    would show 1/2n rows either side.

    See
    http://groups.google.com/group/comp.databases.mysql/browse_thread/thread/9893fdeb1aef4dfa/37aa58773be074e8?lnk=st&q=&rnum=1#37aa58773be074e8

    strawberry Guest

  4. #4

    Default Re: Find records either side of the record found

    On 15 Jun, 13:21, Willem Bogaerts
    <maardanzonderditstuk.nl> wrote: 

    >
    > Sounds like a job for the HANDLER statement:
    >
    > http://dev.mysql.com/doc/refman/5.1/en/handler.html
    >
    > Best regards,
    > --
    > Willem Bogaerts
    >
    > Application smith
    > Kratz B.V.http://www.kratz.nl/[/ref]

    I have been trying this Handler thing and am getting some results. But
    I can only achieve what I want by doing 2 statement and then
    concatenating the results using PHP. Is is possible to do a JOIN on
    two HANDLER statements. I have tried but seem to be getting errors. Is
    this possible or is it just my syntax wrong.

    Also thanks strawberry, I had never heard of the handler either but it
    seems fairly good.

    Iain Guest

  5. #5

    Default Re: Find records either side of the record found

    Willem Bogaerts wrote: 
    >
    > Sounds like a job for the HANDLER statement:
    >
    > http://dev.mysql.com/doc/refman/5.1/en/handler.html
    >
    > Best regards,[/ref]


    indeed, very interesting. thanks for mentioning it.
    lark Guest

Similar Threads

  1. CDML - Found Records
    By Ted in forum FileMaker
    Replies: 3
    Last Post: January 18th, 03:43 PM
  2. Replies: 3
    Last Post: November 12th, 03:22 AM
  3. Find record w/ conditions met in the same child record
    By Thomas Berg in forum FileMaker
    Replies: 2
    Last Post: October 21st, 05:01 AM
  4. Found Records
    By waveyd in forum FileMaker
    Replies: 11
    Last Post: September 11th, 06:06 AM
  5. Message for 0 Records Found
    By DjDrakk in forum PHP Development
    Replies: 2
    Last Post: August 5th, 06:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139