Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Group by with Sort

Author  Topic 

planetoneautomation
Posting Yak Master

105 Posts

Posted - 2010-08-09 : 15:11:04
I have table BUG with two columns of interest: bg_functional_area and bg_technical_area.

I want output to be a line for each functional area with the name of the functional area and the count of rows from the BUG table for each technical area.

Like this:

...........techArea1......techArea2.....techArea3
funcArea1......5..............3.............3
funcArea2......7.............12.............0
funcArea3......3..............8.............6

Note: the periods (.) are there only to make the formatting appear correctly. Not interested in getting period output from sql.

The functional areas appear sorted and the technical areas appear sorted. The group by is on technical area if I'm using the terminology correctly.

revdnrdy
Posting Yak Master

220 Posts

Posted - 2010-08-09 : 18:07:12
Hello;

May I recommend that you use the code tags for your post. This way things will format properly and you won't have to hack it up with less than elegant techniques (like dots).. Just highlight your code and click the insert code button with the # sign on it.

table      techArea1   techArea2  techArea3
funcArea1 5 3 3
funcArea2 7 12 0
funcArea3 3 8 6
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-10 : 13:23:39
are you using sql 2005?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-08-10 : 13:28:52
Is this for a front end display?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -