-
select all colum and the distict count at same time
is that possible to list all the data from table and the distict count number at the same time , if I only use select colum1, colum2.... count(*distinct Id ) I only get the row which Id is over two
Thank you
________
FORD AXOD TRANSMISSION SPECIFICATIONS
Last edited by sql; 03-06-2011 at 02:09 AM.
-
create table test(id int, name varchar(100))
insert into test select 1,'A1'
insert into test select 2,'A2'
insert into test select 3,'A3'
insert into test select 4,'A4'
insert into test select 4,'A5'
insert into test select 5,'A6'
insert into test select 5,'A7'
select id,COUNT(name) from test group by id
-
Thank you Mark,
I get this step alreay, is that possible I get the Sum of COUNT(name)
select id,COUNT(name),Sum(Count(name)) from test group by id is not work
________
MEDICAL MARIJUANA DISPENSARIES
Last edited by sql; 03-06-2011 at 02:10 AM.
-
try this.
select id,sum(COUNT1) from (
select id,COUNT(name) as NAME,Count(name) as COUNT1 from test group by id
) as mytable group by id
-
Thank you mak,
suggestion 2 is not work , I use suggestion I plus
<c:set var="sum" value="${sum + (found.count1)}"/>
in jsTL
thank you
________
Strawberry Cough
Last edited by sql; 03-06-2011 at 02:10 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|