B
Brian
I am a newbie to the SQL, but I was wondering if the
statement below is valid. It doesn't work for me. The
query only uses one table. I wanted to join to Select
statements so I could COUNT a field ("IsComplete") when it
is false and when it is true and GROUP it by the userid.
Thanks. Any help would be useful.
SELECT CTTable.ownerid, CTTable.CompleteTrue,
CFTable.CompleteFalse
FROM
(SELECT task.ownerid, Count(task.ownerid) as CompleteTrue
FROM task WHERE task.tasktype = 2 and task.iscomplete= -1
GROUP BY task.ownerid) as CTTable
INNER JOIN
(SELECT task.ownerid, Count(task.ownerid) as CompleteFalse
FROM task WHERE task.tasktype = 2 and task.iscomplete= 0
GROUP BY task.ownerid) as CFTable
ON CTTable.ownerid = CFTable.ownerid
GROUP BY CTTable.ownerid
statement below is valid. It doesn't work for me. The
query only uses one table. I wanted to join to Select
statements so I could COUNT a field ("IsComplete") when it
is false and when it is true and GROUP it by the userid.
Thanks. Any help would be useful.
SELECT CTTable.ownerid, CTTable.CompleteTrue,
CFTable.CompleteFalse
FROM
(SELECT task.ownerid, Count(task.ownerid) as CompleteTrue
FROM task WHERE task.tasktype = 2 and task.iscomplete= -1
GROUP BY task.ownerid) as CTTable
INNER JOIN
(SELECT task.ownerid, Count(task.ownerid) as CompleteFalse
FROM task WHERE task.tasktype = 2 and task.iscomplete= 0
GROUP BY task.ownerid) as CFTable
ON CTTable.ownerid = CFTable.ownerid
GROUP BY CTTable.ownerid