| Author |
Topic |
|
Easwar
Yak Posting Veteran
59 Posts |
Posted - 2007-03-14 : 01:38:42
|
| Ex Table-----------------ColName====> Field Name------------xyzabcxyzabcabcsdfabc........---------In table column string. i need maximum ColName.. In above table maximum ColName is abc... also top 3 maximum ColName i need...Result------abcHow to i'll get any query........Top 3 Maximum Result--------------------abcxyzsdf----------------------------this also....... |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-14 : 01:48:37
|
| select top 3 distinct colname from table1 order by colname descPeter LarssonHelsingborg, Sweden |
 |
|
|
Easwar
Yak Posting Veteran
59 Posts |
Posted - 2007-03-14 : 01:54:36
|
| select top 3 distinct colname from table1 order by colname descThis query Not worked Error will appearError-------Incorrect syntax near the keyword 'distinct'. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-14 : 01:58:04
|
| Ooops!select distinct top 3 colname from table1 order by colname descPeter LarssonHelsingborg, Sweden |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-14 : 01:58:09
|
[code]select top 3 colname from table1 group by colname order by colname desc[/code] KH |
 |
|
|
Easwar
Yak Posting Veteran
59 Posts |
Posted - 2007-03-14 : 02:12:31
|
| select distinct top 3 colname from table1 order by colname descselect top 3 colname from table1 group by colname order by colname descAbove two query same result..But not correct result......... |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-14 : 02:17:17
|
Sorryselect top 3 colname from table1 group by colname order by colname count(*) desc KH |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-14 : 02:18:09
|
Must have left my brain at home today  KH |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-14 : 02:22:46
|
| Well, OP was not that clear either...Peter LarssonHelsingborg, Sweden |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-14 : 02:32:11
|
quote: Originally posted by Peso Well, OP was not that clear either...Peter LarssonHelsingborg, Sweden
OK. Blame it on the OP . Anyway, i am at home now. Found my brain right where i left it  KH |
 |
|
|
Easwar
Yak Posting Veteran
59 Posts |
Posted - 2007-03-14 : 02:38:29
|
| Thanks very much...........select top 3 colname from table1 group by colname order by count(*) descthis query now worked............ |
 |
|
|
|