MySQL COUNT on WHERE Statement -


pleas me on why count condition on statement commits error, , how fix it?.

         select jq.taskqueueid,jq.jobid            (select p.taskid `curenttaskid`,                     p.taskname `currenttaskname`,                     p.processingtype `currentprocessingtype`,                     p1.taskid `prevtaskid`,                     p1.taskname `prevtaskname`,                     p1.processingtype `prevprocessingtype`                   projecttask p                   left join projecttask p1                     on p.sequenceno=p1.nexttasksequence                    , p.projectid=p1.projectid                  p.taskid=18) task            inner join taskslogs tl               on tl.taskid=task.`prevtaskid`              , tl.statusdefinitionid=1            inner join jobqueue jq               on tl.taskqueueid=jq.taskqueueid            count(jq.taskqueueid)=count(tl.taskqueueid) 

to use aggregate function count() need grouping of data, if want use condition can't use this, since conditions considered before aggregation. use group having instead. (see http://dev.mysql.com/doc/refman/5.0/en/select.html )


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -