You are here: Count and IF « PHP SQL « IT news, forums, messages
Count and IF

Posted by Brian on 05/06/06 21:41

Hi all

I'm trying to write a statment that COUNTS the number of results in a table
(below is a cut down version of the full statment)
but it's not bring back the right results

daynumberscount1 should = the COUNT of number (number is a field name)
between the 2 timestamps where
banned (another field) is = to false

daybannednumbercount1 is the same as daynumberscount1 but banned is = to
true

SELECT COUNT(IF((`timestamp` BETWEEN 1146459600 AND 1146545999) AND
banned="false",`number`,0)) as daynumberscount1, COUNT(IF((`timestamp`
BETWEEN 1146459600 AND 1146545999) AND banned="true",`number`,0)) as
daybannednumbercount1 FROM table WHERE `x` = y


I can't see where i am going wrong??

Brian

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация