RE: newbie sql question .....NESTED QUERY

RE: newbie sql question .....NESTED QUERY

 

  

AT SQL2k you can use a subquery in a FROM clause; look under subquery rather
than nested query. SQL 7 suppots 'nested query' as an alternative term in
BOL but supports the feature only in WHERE or HAVING clauses. Before version
2k, the easiest approach might be to define the SELECT statement as a View.
> -----Original Message-----
> From: Conahan, Patrick [SMTP:Patrick.[Email Address Removed] Sent: Wednesday, May 22, 2002 4:48 PM
> To: '[Email Address Removed] Subject: 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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: mssqldba-[Email Address Removed] For additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page