Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 multiple nested query

Author  Topic 

bpsintl
Posting Yak Master

132 Posts

Posted - 2009-06-05 : 09:41:33
I'm trying to get the following working but the syntax is wrong. Can anyone help please?

select *, (select count(newsletterid) from email_queue where newsletterid = id and isdate(date_sent) = 1) as c, (select count(newsletterid) from email_queue where newsletterid = id and isdate(date_sent) = 0) as q from newsletters order by id desc

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-05 : 13:37:28
[code]
select *, (select count(newsletterid) from email_queue where newsletterid = n.id and isdate(date_sent) = 1) as c, (select count(newsletterid) from email_queue where newsletterid = n.id and isdate(date_sent) = 0) as q from newsletters n order by id desc
[/code]
Go to Top of Page

bpsintl
Posting Yak Master

132 Posts

Posted - 2009-06-05 : 13:51:15
Excellent, just the job! Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-05 : 14:00:28
welcome
Go to Top of Page
   

- Advertisement -