PDA

View Full Version : Trouble combining a query (MSSQL)


WebmasterAJ
Mon 21st Nov '05, 3:46pm
Hey everyone,

First and foremost, I apologize as this relates to MSSQL... I don't know where else this would belong. Sorry about that.

In any case, I need help combining the following queries into one:

SELECT Signups [Total Overall Members] FROM (
SELECT COUNT(Contacts.id) [Signups], 0 [sortCheater]
FROM Contacts
WHERE Deleted = 0 AND DateEntered > '9/12/2005 12:00AM'
)x

and

SELECT Signups [Total Overall Optouts] FROM (
SELECT COUNT(Contacts.id) [Signups], 0 [sortCheater]
FROM Contacts
WHERE Deleted = 1 AND DateEntered > '9/12/2005 12:00AM'

) x

If anyone has any ideas - I would really, really appreciate it!

Thank you very much for your time!

Sincerely,
Andrew Tatum

Lats
Mon 21st Nov '05, 4:28pm
If anyone has any ideas...I'll see your ideas and raise you a couple of guesses :)

Try either one of these...
SELECT Signups [Total Overall Optouts] FROM (
SELECT COUNT(Contacts.id) [Signups], 0 [sortCheater]
FROM Contacts
WHERE Deleted IN (0, 1) AND DateEntered > '9/12/2005 12:00AM'
) x

or
SELECT Signups [Total Overall Optouts] FROM (
SELECT COUNT(Contacts.id) [Signups], 0 [sortCheater]
FROM Contacts
WHERE (Deleted = 0 OR Deleted = 1) AND DateEntered > '9/12/2005 12:00AM'
) x