Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: Mysql query

  1. #1
    Join Date
    Aug 2011
    Posts
    10

    Talking Unanswered: Mysql query

    Hello, I have a big database with thousands of records of numbers in one column.

    Table : Rdata

    Column : numbers

    example of data :

    8
    21
    28
    29
    31
    32
    27
    20
    31
    1
    18
    35
    18
    30
    22
    9
    2
    8
    33
    8
    19
    31
    6
    31
    14
    5
    26
    29
    34
    34
    19
    27
    29
    3
    21
    18
    31
    5
    18
    34
    4
    15
    12
    20
    28
    31
    13
    22
    19
    30
    0
    2
    30
    28
    2
    10
    27
    9
    23
    28
    29
    16
    16
    31
    35
    18
    2
    15
    1
    30
    15
    11
    17
    26
    35
    1
    22
    19
    23
    1
    18
    35
    28
    13
    9
    14

    i need to run a query that for example search for numbers : 20,31,1,18,35,18,30,22 and IF they ALL exist WITH the SAME ORDER returns me whats the next number in the database order. in my example is 9



    Thanks

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    with only one column in your table, it is clearly impossible to do what you want
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2012
    Posts
    84
    Hello,

    is there any field in the table that designates the order of rows ?
    If yes, what is a characteristic of this field (int, varchar, auto increment, primary key, what kind of data does it contain ?).
    If no - and you rely on a physical order on which rows were added to the table, then follow this link: Use ORDER BY in SQL statements at JavaRanch

  4. #4
    Join Date
    Aug 2011
    Posts
    10
    sorry i forgot to mention it i have another column

    1) aa = auto increment, primary key
    2) numbers

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by kordirko View Post
    If no - and you rely on a physical order on which rows were added to the table, then follow this link: Use ORDER BY in SQL statements at JavaRanch
    i think it would have been fairer (rather than referring to another site) simply to say that there is no intrinsic order to the rows in a table, hence the solution is impossible

    Quote Originally Posted by Chrisad View Post
    sorry i forgot to mention it i have another column
    that makes all the difference in the world, you know

    so how many numbers in a row do you want to find?

    because you will have to write one subquery per number

    if you have only thousands of rows (rather than millions), it might be easier as well as more efficient to read them all into an array in your application language (php or whatever) and look for the sequential runs there
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    Join Date
    Aug 2011
    Posts
    10
    i have many thousands, 3 millions (i was ad some more just now).
    EACH row has ONE number.

    i want to check with query the possibility of "cycling" group of records lets as my example before.

  7. #7
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by Chrisad View Post
    i want to check with query the possibility of "cycling" group of records lets as my example before.
    why?

    i mean, what does "cycling" mean?

    what is the purpose? what will this do for your application?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  8. #8
    Join Date
    Aug 2011
    Posts
    10

    database

    its a game record analyzer, and "cycling" means (for me ) that if the game "repeats" the exported data some how.. not very possible but i want to check it.

    could you have a solution or an example ?

    thanks

  9. #9
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    so how many numbers in a row do you want to find?

    because you will have to write one subquery per number
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  10. #10
    Join Date
    Jan 2012
    Posts
    84
    Quote Originally Posted by Chrisad View Post
    its a game record analyzer, and "cycling" means (for me ) that if the game "repeats" the exported data some how.. not very possible but i want to check it.
    Could you explain more precisely what that "cycling" does mean ?
    Does it mean, that the query is expected to find any repeated series of numbers within the table ?

    Anyway, for the problem you asked in the first post (find the first occurrence of the given series of numbers) , the query might look like below:

    sample data:
    Code:
    mysql> create table rdata(
        ->   id int primary key auto_increment,
        ->   number int
        -> );
    Query OK, 0 rows affected (0.10 sec)
    
    mysql> insert into rdata( number )
        -> select floor( rand() * 100 )
        -> from information_schema.columns a
        -> cross join information_schema.columns b
        -> ;
    Query OK, 2924100 rows affected, 2 warnings (35.76 sec)
    Records: 2924100  Duplicates: 0  Warnings: 2
    
    mysql> create index number on rdata( number );
    Query OK, 0 rows affected (27.93 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    This is a table that contains numbers we are looking for:
    Code:
    mysql> create table numbers like rdata;
    Query OK, 0 rows affected (0.11 sec)
    
    mysql> insert into numbers( number )
        -> select number from rdata
        -> limit 10000, 10;
    Query OK, 10 rows affected (0.10 sec)
    Records: 10  Duplicates: 0  Warnings: 0
    
    mysql> select * from numbers;
    +----+--------+
    | id | number |
    +----+--------+
    |  1 |     82 |
    |  2 |     66 |
    |  3 |     86 |
    |  4 |     33 |
    |  5 |      9 |
    |  6 |     44 |
    |  7 |     94 |
    |  8 |     37 |
    |  9 |      6 |
    | 10 |     20 |
    +----+--------+
    10 rows in set (0.00 sec)

    and the query:
    Code:
    mysql> SELECT rdata.*,
        ->        case rdata.id when xy.id + (SELECT count(*) FROM numbers )
        ->             then 'this is a next number after the sequence'
        ->        end comment
        -> FROM rdata
        -> JOIN (
        ->     select xx.id
        ->     from rdata xx
        ->     JOIN rdata r
        ->     ON r.id between xx.id and ( xx.id - 1 + (SELECT count(*) FROM numbers ))
        ->     JOIN numbers num
        ->     ON num.id + xx.id - 1 = r.id and num.number = r.number
        ->     where xx.number = ( select number from numbers where id = 1 )
        ->     group by xx.id
        ->     having count(*) = (SELECT count(*) FROM numbers )
        ->     order by xx.id
        ->     limit 1
        -> ) xy
        -> ON rdata.id between xy.id and xy.id + (SELECT count(*) FROM numbers )
        -> order by rdata.id
        -> ;
    +-------+--------+------------------------------------------+
    | id    | number | comment                                  |
    +-------+--------+------------------------------------------+
    | 10001 |     82 | NULL                                     |
    | 10002 |     66 | NULL                                     |
    | 10003 |     86 | NULL                                     |
    | 10004 |     33 | NULL                                     |
    | 10005 |      9 | NULL                                     |
    | 10006 |     44 | NULL                                     |
    | 10007 |     94 | NULL                                     |
    | 10008 |     37 | NULL                                     |
    | 10009 |      6 | NULL                                     |
    | 10010 |     20 | NULL                                     |
    | 10011 |     82 | this is a next number after the sequence |
    +-------+--------+------------------------------------------+
    11 rows in set (4.01 sec)

  11. #11
    Join Date
    Aug 2011
    Posts
    10
    "Does it mean, that the query is expected to find any repeated series of numbers within the table ?"

    yes something like that!

    i try your sample and i will reply. (tomorrow)

    thanks

  12. #12
    Join Date
    Aug 2011
    Posts
    10
    EDIT 2 : I was SURE that was my fault, works fine. Thanks a million Pal.

    Is there a way to "continue" the query and find if there is the same repeated series of numbers within the table again and again... and not stopping at the first match?
    Last edited by Chrisad; 03-28-12 at 17:26.

  13. #13
    Join Date
    Jan 2012
    Posts
    84
    Quote Originally Posted by Chrisad View Post
    Is there a way to "continue" the query and find if there is the same repeated series of numbers within the table again and again... and not stopping at the first match?
    Yes, just skip the 'LIMIT 1" clause.
    Look at an example:

    First let's copy our sequence of numbers into a few different places in the table
    Code:
    mysql> update rdata
        -> join (
        ->     select n.id + x.x -1 as id, n.number
        ->     from numbers n
        ->     cross join (
        ->         select 450000 as x union
        ->         select 850000 union
        ->         select 1500000 union
        ->         select 2600000
        ->     ) as x
        -> ) as y
        -> on rdata.id = y.id
        -> set rdata.number = y.number;
    Query OK, 0 rows affected (0.12 sec)
    Rows matched: 40  Changed: 0  Warnings: 0
    Place LIMIT 2 if you want two sequences:
    Code:
    SELECT rdata.*,
           case rdata.id when xy.id + (SELECT count(*) FROM numbers )
                then 'this is a next number after the sequence'
           end comment
    FROM rdata
    JOIN (
        select xx.id
        from rdata xx
        JOIN rdata r
        ON r.id between xx.id and ( xx.id - 1 + (SELECT count(*) FROM numbers ))
        JOIN numbers num
        ON num.id + xx.id - 1 = r.id and num.number = r.number
        where xx.number = ( select number from numbers where id = 1 )
        group by xx.id
        having count(*) = (SELECT count(*) FROM numbers )
        order by xx.id
        limit 2  --  
    ) xy
    ON rdata.id between xy.id and xy.id + (SELECT count(*) FROM numbers )
    order by rdata.id;
    
    +--------+--------+------------------------------------------+
    | id     | number | comment                                  |
    +--------+--------+------------------------------------------+
    |  10001 |     82 | NULL                                     |
    |  10002 |     66 | NULL                                     |
    |  10003 |     86 | NULL                                     |
    |  10004 |     33 | NULL                                     |
    |  10005 |      9 | NULL                                     |
    |  10006 |     44 | NULL                                     |
    |  10007 |     94 | NULL                                     |
    |  10008 |     37 | NULL                                     |
    |  10009 |      6 | NULL                                     |
    |  10010 |     20 | NULL                                     |
    |  10011 |     82 | this is a next number after the sequence |
    | 450000 |     82 | NULL                                     |
    | 450001 |     66 | NULL                                     |
    | 450002 |     86 | NULL                                     |
    | 450003 |     33 | NULL                                     |
    | 450004 |      9 | NULL                                     |
    | 450005 |     44 | NULL                                     |
    | 450006 |     94 | NULL                                     |
    | 450007 |     37 | NULL                                     |
    | 450008 |      6 | NULL                                     |
    | 450009 |     20 | NULL                                     |
    | 450010 |     88 | this is a next number after the sequence |
    +--------+--------+------------------------------------------+
    22 rows in set (5.25 sec)
    Skip the LIMIT clause and you'll get all sequences:
    Code:
    SELECT rdata.*,
           case rdata.id when xy.id + (SELECT count(*) FROM numbers )
                then 'this is a next number after the sequence'
           end comment
    FROM rdata
    JOIN (
        select xx.id
        from rdata xx
        JOIN rdata r
        ON r.id between xx.id and ( xx.id - 1 + (SELECT count(*) FROM numbers ))
        JOIN numbers num
        ON num.id + xx.id - 1 = r.id and num.number = r.number
        where xx.number = ( select number from numbers where id = 1 )
        group by xx.id
        having count(*) = (SELECT count(*) FROM numbers )
        order by xx.id
        -- limit 2
    ) xy
    ON rdata.id between xy.id and xy.id + (SELECT count(*) FROM numbers )
    order by rdata.id
    ;
    +---------+--------+------------------------------------------+
    | id      | number | comment                                  |
    +---------+--------+------------------------------------------+
    |   10001 |     82 | NULL                                     |
    |   10002 |     66 | NULL                                     |
    |   10003 |     86 | NULL                                     |
    |   10004 |     33 | NULL                                     |
    |   10005 |      9 | NULL                                     |
    |   10006 |     44 | NULL                                     |
    |   10007 |     94 | NULL                                     |
    |   10008 |     37 | NULL                                     |
    |   10009 |      6 | NULL                                     |
    |   10010 |     20 | NULL                                     |
    |   10011 |     82 | this is a next number after the sequence |
    |  450000 |     82 | NULL                                     |
    |  450001 |     66 | NULL                                     |
    |  450002 |     86 | NULL                                     |
    |  450003 |     33 | NULL                                     |
    |  450004 |      9 | NULL                                     |
    |  450005 |     44 | NULL                                     |
    |  450006 |     94 | NULL                                     |
    |  450007 |     37 | NULL                                     |
    |  450008 |      6 | NULL                                     |
    |  450009 |     20 | NULL                                     |
    |  450010 |     88 | this is a next number after the sequence |
    |  850000 |     82 | NULL                                     |
    |  850001 |     66 | NULL                                     |
    |  850002 |     86 | NULL                                     |
    |  850003 |     33 | NULL                                     |
    |  850004 |      9 | NULL                                     |
    |  850005 |     44 | NULL                                     |
    |  850006 |     94 | NULL                                     |
    |  850007 |     37 | NULL                                     |
    |  850008 |      6 | NULL                                     |
    |  850009 |     20 | NULL                                     |
    |  850010 |     83 | this is a next number after the sequence |
    | 1500000 |     82 | NULL                                     |
    | 1500001 |     66 | NULL                                     |
    | 1500002 |     86 | NULL                                     |
    | 1500003 |     33 | NULL                                     |
    | 1500004 |      9 | NULL                                     |
    | 1500005 |     44 | NULL                                     |
    | 1500006 |     94 | NULL                                     |
    | 1500007 |     37 | NULL                                     |
    | 1500008 |      6 | NULL                                     |
    | 1500009 |     20 | NULL                                     |
    | 1500010 |     48 | this is a next number after the sequence |
    | 2600000 |     82 | NULL                                     |
    | 2600001 |     66 | NULL                                     |
    | 2600002 |     86 | NULL                                     |
    | 2600003 |     33 | NULL                                     |
    | 2600004 |      9 | NULL                                     |
    | 2600005 |     44 | NULL                                     |
    | 2600006 |     94 | NULL                                     |
    | 2600007 |     37 | NULL                                     |
    | 2600008 |      6 | NULL                                     |
    | 2600009 |     20 | NULL                                     |
    | 2600010 |     89 | this is a next number after the sequence |
    +---------+--------+------------------------------------------+
    55 rows in set (7.16 sec)
    If you know that the third sequence starts at id = 850000,
    then you can retrieve only the fourth sequence with this query:
    Code:
    SELECT rdata.*,
           case rdata.id when xy.id + (SELECT count(*) FROM numbers )
                then 'this is a next number after the sequence'
           end comment
    FROM rdata
    JOIN (
        select xx.id
        from rdata xx
        JOIN rdata r
        ON r.id between xx.id and ( xx.id - 1 + (SELECT count(*) FROM numbers ))
        JOIN numbers num
        ON num.id + xx.id - 1 = r.id and num.number = r.number
        where xx.number = ( select number from numbers where id = 1 )
              AND xx.id > 850000  -- third sequence starts at 850000
        group by xx.id
        having count(*) = (SELECT count(*) FROM numbers )
        order by xx.id
        limit 1
    ) xy
    ON rdata.id between xy.id and xy.id + (SELECT count(*) FROM numbers )
    order by rdata.id
    ;
    +---------+--------+------------------------------------------+
    | id      | number | comment                                  |
    +---------+--------+------------------------------------------+
    | 1500000 |     82 | NULL                                     |
    | 1500001 |     66 | NULL                                     |
    | 1500002 |     86 | NULL                                     |
    | 1500003 |     33 | NULL                                     |
    | 1500004 |      9 | NULL                                     |
    | 1500005 |     44 | NULL                                     |
    | 1500006 |     94 | NULL                                     |
    | 1500007 |     37 | NULL                                     |
    | 1500008 |      6 | NULL                                     |
    | 1500009 |     20 | NULL                                     |
    | 1500010 |     48 | this is a next number after the sequence |
    +---------+--------+------------------------------------------+
    11 rows in set (1.16 sec)

  14. #14
    Join Date
    Jan 2012
    Posts
    84
    Just for curiosity
    - if you want to number sequences, you may do it in this way:
    Code:
    SELECT xy.seq_nbr, rdata.*,
           case rdata.id when xy.id + (SELECT count(*) FROM numbers )
                then 'this is a next number after the sequence'
           end comment
    FROM rdata
    JOIN (
        select (@seq_nbr := @seq_nbr + 1) as seq_nbr, id
        FROM (
            select xx.id
            from rdata xx
            JOIN rdata r
            ON r.id between xx.id and ( xx.id - 1 + (SELECT count(*) FROM numbers ))
            JOIN numbers num
            ON num.id + xx.id - 1 = r.id and num.number = r.number
            where xx.number = ( select number from numbers where id = 1 )
            --    AND xx.id > 850000  -- third sequence starts at 850000
            group by xx.id
            having count(*) = (SELECT count(*) FROM numbers )
            order by xx.id
           -- limit 1
         ) as xyz
         cross join (select (@seq_nbr := 0) as sq ) as sq
    ) as xy
    ON rdata.id between xy.id and xy.id + (SELECT count(*) FROM numbers )
    order by rdata.id
    ;
    +---------+---------+--------+------------------------------------------+
    | seq_nbr | id      | number | comment                                  |
    +---------+---------+--------+------------------------------------------+
    |       1 |   10001 |     82 | NULL                                     |
    |       1 |   10002 |     66 | NULL                                     |
    |       1 |   10003 |     86 | NULL                                     |
    |       1 |   10004 |     33 | NULL                                     |
    |       1 |   10005 |      9 | NULL                                     |
    |       1 |   10006 |     44 | NULL                                     |
    |       1 |   10007 |     94 | NULL                                     |
    |       1 |   10008 |     37 | NULL                                     |
    |       1 |   10009 |      6 | NULL                                     |
    |       1 |   10010 |     20 | NULL                                     |
    |       1 |   10011 |     82 | this is a next number after the sequence |
    |       2 |  450000 |     82 | NULL                                     |
    |       2 |  450001 |     66 | NULL                                     |
    |       2 |  450002 |     86 | NULL                                     |
    |       2 |  450003 |     33 | NULL                                     |
    |       2 |  450004 |      9 | NULL                                     |
    |       2 |  450005 |     44 | NULL                                     |
    |       2 |  450006 |     94 | NULL                                     |
    |       2 |  450007 |     37 | NULL                                     |
    |       2 |  450008 |      6 | NULL                                     |
    |       2 |  450009 |     20 | NULL                                     |
    |       2 |  450010 |     88 | this is a next number after the sequence |
    |       3 |  850000 |     82 | NULL                                     |
    |       3 |  850001 |     66 | NULL                                     |
    |       3 |  850002 |     86 | NULL                                     |
    |       3 |  850003 |     33 | NULL                                     |
    |       3 |  850004 |      9 | NULL                                     |
    |       3 |  850005 |     44 | NULL                                     |
    |       3 |  850006 |     94 | NULL                                     |
    |       3 |  850007 |     37 | NULL                                     |
    |       3 |  850008 |      6 | NULL                                     |
    |       3 |  850009 |     20 | NULL                                     |
    |       3 |  850010 |     83 | this is a next number after the sequence |
    |       4 | 1500000 |     82 | NULL                                     |
    |       4 | 1500001 |     66 | NULL                                     |
    |       4 | 1500002 |     86 | NULL                                     |
    |       4 | 1500003 |     33 | NULL                                     |
    |       4 | 1500004 |      9 | NULL                                     |
    |       4 | 1500005 |     44 | NULL                                     |
    |       4 | 1500006 |     94 | NULL                                     |
    |       4 | 1500007 |     37 | NULL                                     |
    |       4 | 1500008 |      6 | NULL                                     |
    |       4 | 1500009 |     20 | NULL                                     |
    |       4 | 1500010 |     48 | this is a next number after the sequence |
    |       5 | 2600000 |     82 | NULL                                     |
    |       5 | 2600001 |     66 | NULL                                     |
    |       5 | 2600002 |     86 | NULL                                     |
    |       5 | 2600003 |     33 | NULL                                     |
    |       5 | 2600004 |      9 | NULL                                     |
    |       5 | 2600005 |     44 | NULL                                     |
    |       5 | 2600006 |     94 | NULL                                     |
    |       5 | 2600007 |     37 | NULL                                     |
    |       5 | 2600008 |      6 | NULL                                     |
    |       5 | 2600009 |     20 | NULL                                     |
    |       5 | 2600010 |     89 | this is a next number after the sequence |
    +---------+---------+--------+------------------------------------------+
    55 rows in set (5.30 sec)
    just place WHERE seq_nbr = X at the end of the query to filter out desired sequence.

  15. #15
    Join Date
    Aug 2011
    Posts
    10
    Quote Originally Posted by kordirko View Post
    Just for curiosity
    - if you want to number sequences, you may do it in this way:
    Code:
    SELECT xy.seq_nbr, rdata.*,
           case rdata.id when xy.id + (SELECT count(*) FROM numbers )
                then 'this is a next number after the sequence'
           end comment
    FROM rdata
    JOIN (
        select (@seq_nbr := @seq_nbr + 1) as seq_nbr, id
        FROM (
            select xx.id
            from rdata xx
            JOIN rdata r
            ON r.id between xx.id and ( xx.id - 1 + (SELECT count(*) FROM numbers ))
            JOIN numbers num
            ON num.id + xx.id - 1 = r.id and num.number = r.number
            where xx.number = ( select number from numbers where id = 1 )
            --    AND xx.id > 850000  -- third sequence starts at 850000
            group by xx.id
            having count(*) = (SELECT count(*) FROM numbers )
            order by xx.id
           -- limit 1
         ) as xyz
         cross join (select (@seq_nbr := 0) as sq ) as sq
    ) as xy
    ON rdata.id between xy.id and xy.id + (SELECT count(*) FROM numbers )
    order by rdata.id
    ;
    +---------+---------+--------+------------------------------------------+
    | seq_nbr | id      | number | comment                                  |
    +---------+---------+--------+------------------------------------------+
    |       1 |   10001 |     82 | NULL                                     |
    |       1 |   10002 |     66 | NULL                                     |
    |       1 |   10003 |     86 | NULL                                     |
    |       1 |   10004 |     33 | NULL                                     |
    |       1 |   10005 |      9 | NULL                                     |
    |       1 |   10006 |     44 | NULL                                     |
    |       1 |   10007 |     94 | NULL                                     |
    |       1 |   10008 |     37 | NULL                                     |
    |       1 |   10009 |      6 | NULL                                     |
    |       1 |   10010 |     20 | NULL                                     |
    |       1 |   10011 |     82 | this is a next number after the sequence |
    |       2 |  450000 |     82 | NULL                                     |
    |       2 |  450001 |     66 | NULL                                     |
    |       2 |  450002 |     86 | NULL                                     |
    |       2 |  450003 |     33 | NULL                                     |
    |       2 |  450004 |      9 | NULL                                     |
    |       2 |  450005 |     44 | NULL                                     |
    |       2 |  450006 |     94 | NULL                                     |
    |       2 |  450007 |     37 | NULL                                     |
    |       2 |  450008 |      6 | NULL                                     |
    |       2 |  450009 |     20 | NULL                                     |
    |       2 |  450010 |     88 | this is a next number after the sequence |
    |       3 |  850000 |     82 | NULL                                     |
    |       3 |  850001 |     66 | NULL                                     |
    |       3 |  850002 |     86 | NULL                                     |
    |       3 |  850003 |     33 | NULL                                     |
    |       3 |  850004 |      9 | NULL                                     |
    |       3 |  850005 |     44 | NULL                                     |
    |       3 |  850006 |     94 | NULL                                     |
    |       3 |  850007 |     37 | NULL                                     |
    |       3 |  850008 |      6 | NULL                                     |
    |       3 |  850009 |     20 | NULL                                     |
    |       3 |  850010 |     83 | this is a next number after the sequence |
    |       4 | 1500000 |     82 | NULL                                     |
    |       4 | 1500001 |     66 | NULL                                     |
    |       4 | 1500002 |     86 | NULL                                     |
    |       4 | 1500003 |     33 | NULL                                     |
    |       4 | 1500004 |      9 | NULL                                     |
    |       4 | 1500005 |     44 | NULL                                     |
    |       4 | 1500006 |     94 | NULL                                     |
    |       4 | 1500007 |     37 | NULL                                     |
    |       4 | 1500008 |      6 | NULL                                     |
    |       4 | 1500009 |     20 | NULL                                     |
    |       4 | 1500010 |     48 | this is a next number after the sequence |
    |       5 | 2600000 |     82 | NULL                                     |
    |       5 | 2600001 |     66 | NULL                                     |
    |       5 | 2600002 |     86 | NULL                                     |
    |       5 | 2600003 |     33 | NULL                                     |
    |       5 | 2600004 |      9 | NULL                                     |
    |       5 | 2600005 |     44 | NULL                                     |
    |       5 | 2600006 |     94 | NULL                                     |
    |       5 | 2600007 |     37 | NULL                                     |
    |       5 | 2600008 |      6 | NULL                                     |
    |       5 | 2600009 |     20 | NULL                                     |
    |       5 | 2600010 |     89 | this is a next number after the sequence |
    +---------+---------+--------+------------------------------------------+
    55 rows in set (5.30 sec)
    just place WHERE seq_nbr = X at the end of the query to filter out desired sequence.
    excellent job m8, i will return tomorrow with next level questions!
    a big thanks once again.
    Last edited by Chrisad; 03-29-12 at 09:45.

Posting Permissions

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