Hi I have 2 SQL fragments that pull up 2 differing results and I have no 
idea why. The two pieces of code are identical bar one line which is :

AND individual_id ='AB00090004' AND Category = 'DXS1047'

The code that produces the correct code is:

select Raw3_2.category,
        Raw3_2.Individual_ID,
        Raw3_2.Inactivate, count(*) as count,
        min(key_num) as minkey,
        max(key_num) as maxkey
        from Raw3_2 where individual_id not like "control%" and inactivate=0
        AND individual_id ='AB00090004' AND Category = 'DXS1047'
        group by category,Individual_ID,Inactivate

gives the CORRECT result below:

+----------+---------------+------------+-------+---------+---------+
| category | Individual_ID | Inactivate | count | minkey  | maxkey  |
+----------+---------------+------------+-------+---------+---------+
| DXS1047  | AB00090004    |          0 |     3 | 2027223 | 2064251 |
+----------+---------------+------------+-------+---------+---------+

Here the count is three, which is correct.

When the same code is run but without the line:

AND individual_id ='AB00090004' AND Category = 'DXS1047'

a fragment of the results is:

+----------+---------------+------------+-------+---------+---------+
| category | Individual_ID | Inactivate | count | minkey  | maxkey  |
+----------+---------------+------------+-------+---------+---------+
| DXS1047  | AB00090004    |          0 |     1 | 2027223 | 2027223 |
+----------+---------------+------------+-------+---------+---------+
| DXS1047  | AB00090004    |          0 |     2 | 2063277 | 2064251 |
+----------+---------------+------------+-------+---------+---------+

Any ideas why? Any help would be greatly appreciated,

Thanks in advance
Rich


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to