Hi. Could you run the following query:
SELECT IF(call_end - call_start > 5, id, NULL) AS long, IF(call_end - call_start <= 5, id, NULL) AS short, COUNT(*) FROM t_calllog_calls GROUP BY long, short Given that I have not made any mistake, that should list all rows which do not "behave" as expected for whatever reason. From your description, you expect there to be two rows: long short 0 non-0 non-0 0 But you should get some additional row(s), which account for the difference you observe. Once you know in which way the condition fails (e.g. both comparisons resulting in NULL), you can search for these rows: SELECT IF(call_end - call_start > 5, id, NULL) AS long, IF(call_end - call_start <= 5, id, NULL) AS short, * FROM t_calllog_calls HAVING ISNULL(short) AND ISNULL(long) (of course you may have to change this accordingly). One of may best bets would be that call_end and call_start are of some data type for which your comparison results in NULL due to some illegal value or because the comparison is not defined or whatever. Please report any findings you get. Regards, Benjamin. PS: People, please learn to quote. There is no reason to quote 60 lines of mail footers! On Tue 2002-09-17 at 12:37:59 -0700, [EMAIL PROTECTED] wrote: > > > > My query: > > > > > > > > SELECT > > > > count(id), > > > > count( IF(call_end - call_start > 5, id, NULL) ), > > > > count( IF(call_end - call_start <= 5, id, NULL) ) > > > > FROM > > > > t_calllog_calls; > > > > > > > > My result: > > > > > > > > 1994 > > > > 1956 > > > > 35 > > > > > > > > However, 1956 + 35 != 1994. > > > > > > > > Running MySQL 3.23.49-nt [...] -- [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