newbie sql question .....NESTED QUERY

newbie sql question .....NESTED QUERY

 

  

Is there any way to do a nested query like:

SELECT CLB_RUN, COUNT(*) FROM
(SELECT CLAIM, MAX(CLB_RUN) FROM INF_CLAIM_BATCH
GROUP BY CLAIM)
GROUP BY CLB_RUN

I've been doing the 'SELECT CLAIM, MAX(CLB_RUN) FROM INF_CLAIM_BATCH' first
and creating a temp table, then doing the query off of that, but certainly
it would be more convenient to do it this way. I looked up nested query in
books online and found nothing

Patrick Conahan
Consultant


MS Sql Server LazyDBA home page