SQL Server Performance Forum – Threads Archive
Sql……select
This is my tableCo Name Count
522 Ja 4
522 Ho 4
528 Ri 5
123 Jame 1
123 Timmy 1
678 Nu 7 The result that I am trying to do is 522 Ja 4
528 Ri 5
123 Jame 1
678 Nu 7 In other word, I want the value that is duplicated in field Count return just only one…… !! Any comment !!
Try this Select Co,Name,Count from yourTable T
where Name=(Select top 1 Name from yourTable where Co=T.Co and Count=T.count) Madhivanan Failing to plan is Planning to fail
hey! is that possible ?
i think it’s not but u can display this
522 4
528 5
123 1
678 5 by running this command select co,count from table
group by co,count
krishna chaitanya sanka
project engineer-SQLDBA ‘TO IMPROVE IS TO CHANGE….TO BE PERFECT IS TO CHANGE OFTEN!!!!
chaitu1385, mine is what the questioner needed [<img src=’/community/emoticons/emotion-1.gif’ alt=’

select co,max(name),cnt
from t1
group by co,cnt
hey sorry for my reply what madhavan said is really working thanx madhavan……i didn’t try what u said before my first reply krishna chaitanya sanka
project engineer-SQLDBA ‘TO IMPROVE IS TO CHANGE….TO BE PERFECT IS TO CHANGE OFTEN!!!!
quote:Originally posted by ranjitjain
select co,max(name),cnt
from t1
group by co,cnt
from t1
group by co,cnt
Instead of 123 Jame 1 your query will return 123 Timmy 1
Madhivanan Failing to plan is Planning to fail
>>thanx madhavan……i didn’t try what u said before my first reply<br /><br />No Problem [<img src=’/community/emoticons/emotion-1.gif’ alt=’

Madhivanan,
Read posters questions again……
>>>>>>>In other word, I want the value that is duplicated in field Count return just only one…… !! Any comment !! He wants only one record irrespective of name from this line it suggests.
But his desired result is just an example i guess…………. Anyways i’m providing the above query according to the line>>>>>>>>>>>>>I want the value that is duplicated in field Count return just only one
Well. In that case you are right [<img src=’/community/emoticons/emotion-1.gif’ alt=’

Finally you got convinced[<img src=’/community/emoticons/emotion-5.gif’ alt=’



>>Finally you got convinced<br /><br />Yes. No Problem [<img src=’/community/emoticons/emotion-1.gif’ alt=’


]]>