I have a table called messages, the 3 columns I am working with are:-
messageID, responseID, projectID

I am trying to write a single query that will give me a total count of 
several columns:-

Here is a pseudo code example of what I want

variable = 1
select total messages (where responseID = 0) as threads
select total messages (where responseID = messageID) as totalmessages
where projectID = #variable#

Here is what I have been playing with that doesn't work. I know what it is 
doing, it is comparing the messageID with responseID on each row 
individually and finding them not the same, rather than comparing every 
rows responseID against each messageID as I want.

SELECT (select count(*) from messages where projectID = #URL.projectID# and 
responseID = 0) as threads,
(select count(*) from messages where projectID = #URL.projectID# and 
responseID = messageID) as totalmsg
FROM messages
where projectID = #URL.projectID#

Agghh help.

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to