May 19, 2009 at 1:24 am
I need query like
select count(name),name,surname from info
table info has only three columns
id int,
name varchar,
surname varchar
May 19, 2009 at 1:30 am
select count(*), name, surname
from TableName
group by name, surname
May 19, 2009 at 1:45 am
ok.
But I do not need row count i need count(name).
eg.
count(name) name surname
--------------------------------
1 may jar
2 may kar
3 may sar
4 apl ril
5 apl rol
then result should be
count(name) name surname
-----------------------------------
3 may jar
3 may kar
3 may sar
2 apl ril
2 apl rol
May 19, 2009 at 2:00 am
SELECT
COUNT(*) OVER (PARTITION BY name), name, surname
FROM
Info
May 19, 2009 at 2:00 am
select name, surname, (select count(*) from Info where name=a.name) as countname
from Info a
"Don't limit your challenges, challenge your limits"
May 19, 2009 at 2:07 am
mjarsaniya (5/19/2009)
ok.But I do not need row count i need count(name).
eg.
count(name) name surname
--------------------------------
1 may jar
2 may kar
3 may sar
4 apl ril
5 apl rol
then result should be
count(name) name surname
-----------------------------------
3 may jar
3 may kar
3 may sar
2 apl ril
2 apl rol
This is why giving example input and output in the original question is a good idea!
Peter has the answer for you
May 19, 2009 at 2:15 am
Thanks,
kruti, Peter Brinkhaus
your both's reply works and i get solution thanks............
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply