MySQL Forums
Forum List  »  Newbie

count with select distinct?
Posted by: Ben Huntsman
Date: July 20, 2012 03:09PM

Hi there!
SQL's not my strong suit, but I'm trying to learn a thing or two, but this case has me stumped. Let's say I have a table like this (pardon the formatting):

software version computer location
----------------------------------------------------------------------
1 2805 150 somewhere
1 2805 1866 somewhere
2 2 137 somewhere
2 2 150 somewhere
2 2 550 somewhere

Now, I want to return two results columns, one for the software, one for the count of computers. As you can see in the table, there are multiple rows, one for each computer id number, but the software id number is repeated. So basically, I'm after a result set that looks like this:

software installedcount
------------------------------------------
1 2
2 3

Anyone know how to pull that off?

Many, many thanks in advance!!

Options: ReplyQuote


Subject
Written By
Posted
count with select distinct?
July 20, 2012 03:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.