Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

An explanation on rowcounts

Status
Not open for further replies.

somnath74

Technical User
Mar 5, 2002
24
IN
Hi friends,
I have come across a very strange feature.Can someone please explain to me as to how it works out.Basically a query to get the row counts of a group by having caluse.
This is the pseudo code

select count(isnull MAX(TAB.COL2),0))
from TAB
where
TAB.COL1=<value>
and TAB.COL3=<value>
group by
TAB.COL1,TAB.COL2
having
TAB.COL1=<value>
and TAB.COL3=<value>
and TAB.COL5=MAX(TAB.COL5)

Now what I see is this query is returning the rowcount of such records.I was expecting it to return the number of rows for each of the groups in the where and having clause.By removing the MAX clause I get that result.How is the processor exactly processing this query to return the number of rows? I set the showplan on but that was not of much help!
Can someone please explicitly explain the query steps that are followed for this query ?

Thanks in advance

Somnath
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top