all groups > sql server programming > november 2006 >
You're in the

sql server programming

group:

Select one record per category from many ?


RE: Select one record per category from many ? xgopi
11/7/2006 8:16:01 PM
sql server programming:
If i understand ur qeustion correctly then
you can use select distinct(category)

[quoted text, click to view]
RE: Select one record per category from many ? xgopi
11/7/2006 8:20:01 PM
to get "one summary row per category"

Group by category and use sum() or any other function as required

[quoted text, click to view]
Select one record per category from many ? +Bob+
11/7/2006 11:00:03 PM
I have a table that contains records in various categories. Let's call
the possible categories A, B, C, D, E, etc. I need to pull just a list
of the categories that are in the table.

On a particular day there may be hundreds of records but only in
categories A, D, and E. I don't want all the records, I just need a
list of categories. So, on this particular day, I should get three
records (rows) back.

How do I write an SQL statement that says "just give me one summary
row per category" ?

Re: Select one record per category from many ? Uri Dimant
11/8/2006 12:00:00 AM
Bob

You need GROPUP BY day(datecolumn)



[quoted text, click to view]

Re: Select one record per category from many ? +Bob+
11/8/2006 12:00:00 AM
On Wed, 8 Nov 2006 08:08:13 +0200, "Uri Dimant" <urid@iscar.co.il>
[quoted text, click to view]


Thanks Uri... that got me on my way!

AddThis Social Bookmark Button