SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Multiple Selects in one statement
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

phate06
Starting Member

16 Posts

Posted - 09/04/2013 :  06:06:58  Show Profile
Hi Guys

I need to return three individual results based on one table, below is my query but it does not like it, I am getting syntax errors see below too - can any one advise?

select
(
Select (COUNT (CustomerID)) as 'Trade Account' from customer where CustomerCode like 'TRC%' and Deleted = 0
Select (COUNT (CustomerID)) as 'Credit Account'from Customer where CustomerCode not like 'TRC%' and Deleted=0 and CashAccount=0
Select (COUNT (CustomerID)) as 'Cash Account' from Customer where CustomerCode like 'CAS%' and Deleted=0 and CashAccount=1
)From Customer

Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'Select'.
Msg 102, Level 15, State 1, Line 6
Incorrect syntax near ')'.

robvolk
Most Valuable Yak

USA
15635 Posts

Posted - 09/04/2013 :  07:38:06  Show Profile  Visit robvolk's Homepage
Duplicate:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=187972
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000