Hello ,


here is a strange result I obtain,
could someone tell me if it's a bug or if my request is wrong

I'd like to obtain the number of times the word 'liste' is found in
column page and the number of times the word 'piece' is found, all in
a single request...

In the last example, it look like for the first row, the result of the first column is
added in the result of the second one !

I use this mysqld version on redhat 7.1 :  3.23.36-log


mysql> select numObj,count(*)
    -> from ttywstats
    -> where login='jdalton'
    ->   and page='liste'
    -> group by numObj;
+--------+----------+
| numObj | count(*) |
+--------+----------+
|      0 |       10 |
+--------+----------+
1 row in set (0.02 sec)



mysql> select numObj,count(*)
    -> from ttywstats
    -> where login='jdalton'
    ->   and page='piece'
    -> group by numObj;
+--------+----------+
| numObj | count(*) |
+--------+----------+
|      0 |       24 |
| 116976 |        2 |
| 116977 |        1 |
| 116978 |        7 |
| 116979 |       13 |
| 116980 |        6 |
| 116981 |       15 |
+--------+----------+
7 rows in set (0.02 sec)





mysql> select numObj,if(page='piece',sum(1),sum(0)) as n1,
    ->                if(page='liste',sum(1),sum(0)) as n2
    -> from ttywstats
    -> where login='jdalton'
    ->   and  page in ('liste','piece')
    -> group by numObj;
+--------+------+------+
| numObj | n1   | n2   |
+--------+------+------+
|      0 |    0 |   34 |
| 116976 |    2 |    0 |
| 116977 |    1 |    0 |
| 116978 |    7 |    0 |
| 116979 |   13 |    0 |
| 116980 |    6 |    0 |
| 116981 |   15 |    0 |
+--------+------+------+
7 rows in set (0.02 sec)
  

-- 
Best regards,
 SixK 
             //
         \\ //    Amiga spirit will never die
          \\/

                         mailto:[EMAIL PROTECTED]


---------------------------------------------------------------------
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