Need help with this sql grouping/aggregate query
Need help with this sql grouping/aggregate query
(OP)
Hi,
I have a query that gives this table
----------------|
count | user |
----------------|
1 | sam |
----------------|
13 | sam |
----------------|
1 | pat |
----------------|
7 | gus |
----------------|
1 | art |
----------------|
For this discussion, let's say that it lists the count of some units that each user has.
The query for this is simple enuff.
select count(count), user
from <table>
group by user;
Now what I want now is a display that shows the number of users that have the same unit count value. So the table would look like this.
--------------|
count | u_count |
--------------|
1 | 3 |
--------------|
13 | 1 |
--------------|
7 | 1 |
--------------|
Is there a way to use sql only to accomplish this?
TIA,
george
I have a query that gives this table
----------------|
count | user |
----------------|
1 | sam |
----------------|
13 | sam |
----------------|
1 | pat |
----------------|
7 | gus |
----------------|
1 | art |
----------------|
For this discussion, let's say that it lists the count of some units that each user has.
The query for this is simple enuff.
select count(count), user
from <table>
group by user;
Now what I want now is a display that shows the number of users that have the same unit count value. So the table would look like this.
--------------|
count | u_count |
--------------|
1 | 3 |
--------------|
13 | 1 |
--------------|
7 | 1 |
--------------|
Is there a way to use sql only to accomplish this?
TIA,
george





RE: Need help with this sql grouping/aggregate query
RE: Need help with this sql grouping/aggregate query
Select Count As Count1, Count(User)
From Table
Group by Count1
Hope this helps!