Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: RE: RES: Counting rows specially - SOLVED


Message #1 by Bukovansky@a... on Fri, 10 Aug 2001 17:12:19 +0200
I neeed for my ASP page and in one recordset (shortening the time
of connection to SQL)...

But after half of hour hard work I found solution:

SELECT Producer_code,
       Producer_count =3D
       (SELECT COUNT(Producer_code) FROM Goods G1
               WHERE G.Vyrobce =3D G1.Vyrobce),
       Category_code,
       Category_count =3D
       (SELECT COUNT(Category_code) FROM Goods G2
               WHERE (G.Vyrobce =3D G2.Vyrobce)
               AND (G.Category_code =3D G2.Category_code)),
       Subcategory_code,
       Subcategory_count =3D COUNT(Subcategory_code)
FROM Goods G
WHERE Producer_code =3D 'Johnandco'
GROUP BY Producer_code, Category_code, Subcategory_code
ORDER BY Producer_code, Category_code, Subcategory_code

As said in one nice movie: NICE ONE BROTHER! :o)
It's very quick...

Thanx to big SQL community for spreading the spirit
without I won't solve it.
I hope you all understand what I want to tell you.

Sorry for my english, I'm czech.

Regards,

Richard Bukovansky



  Return to Index