We help IT Professionals succeed at work.
Get Started

Another simple SQL query

Last Modified: 2013-12-07
I have a query that returns all rows with a single identifier:

select ParentLink_RecId
        from TASK
        --where (RESOLVEDDATETIME) = 2008
        Group by ParentLink_RecId
        having count(ParentLink_RecId) = 1

Now what I want to do is use this as the input in a nested SQL query:

e.g. select count(1)
from (select ParentLink_RecId
        from TASK
        where (RESOLVEDDATETIME) = 2008
        Group by ParentLink_RecId, ownerteam, month(RESOLVEDDATETIME)
        having count(ParentLink_RecId) = 1)
I get a Incorrect syntax near )

I need to only pull relevant data back from the initial result set any ideas?

Any idea's as this should be easy - I essentially just need to loop the input from the initial query bringing back other details
Watch Question
Awarded 2008
Awarded 2008
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE