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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 selecting multiple records with GROUP BY and COUNT???

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-09-29 : 08:04:09
Daniel writes "Hi!

SELECT itemname, fk_brand, COUNT(*) counter FROM items WHERE (fk_brand = 1) GROUP BY (fk_brand)

This is not possible, why?
How do I get "itemname" out with the rest of the data: (fk_brand and counter) ???

I know it's easy, but I can't find a way to do it :-(.

Help me please!

/Daniel"

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2003-09-29 : 08:21:36
see http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=29412

and/or do a search on GROUP for related advice
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-09-29 : 09:42:27
Which one? I expect you could have many...If not, why not group by it...

You could also Try MAX or MIN



Brett

8-)

SELECT @@POST FROM Brain ORDER BY NewId()

That's correct! It's an AlphaNumeric!
Go to Top of Page
   

- Advertisement -