troubleshooting Question

Subquery in Query Builder (VS 2008) - Error "Error in list of function arguments: 'SELECT' not recognized.

Avatar of hershes
hershes asked on
Microsoft SQL Server.NET ProgrammingMicrosoft Development
4 Comments1 Solution824 ViewsLast Modified:
Hi all!
I'm trying to use the subquery in this query builder and getting error
"Error in list of function arguments: 'SELECT' not recognized."
But I getting the valid results.
What I do wrong?

Thanks in advance!

This is my query:

SELECT        MAX(CDS.dest_dn) AS QDN,
(SELECT        COUNT(idcalldetail)
 FROM            calldetails AS submain
 WHERE        (status = '6') AND (submain.dest_dn = MAX(CDS.dest_dn)) AND (MAX(to_char(CDS.starttime, 'YYYY-MM-DD')) = to_char(submain.starttime,  'YYYY-MM-DD')) AND (to_char(submain.starttime, 'HH24') = MAX(to_char(CDS.starttime, 'HH24')))) AS count_answ

FROM            calldetails AS CDS, callhistory3 AS main
WHERE        ((CDS.dest_dn = '8016') AND (to_char(CDS.starttime, 'YYYY-MM-DD') = '2009-11-23')) AND (main.idcallhistory3 = CDS.idcallhistory2)
GROUP BY H1
ORDER BY H1
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros