than my suggestion but you could loop through the results of your
count query (it wont be a big database call - you only have 20 records
to loop through) and run separate queries for each value of field1.
Cheers
Mike Kear
Windsor, NSW, Australia
AFP Webworks
http://afpwebworks.com
.com,.net,.org domains from AUD$20/Year
----- Original Message -----
From: alexander sicular <[EMAIL PROTECTED]>
Date: Sun, 03 Oct 2004 19:08:29 -0400
Subject: ot: distinct count query; mssql2k
To: CF-Talk <[EMAIL PROTECTED]>
hi all,
i am trying to query a table for most often inserted values and have
stumbled into a roadblock. the query i have so far works as expected:
select top 20 field1, COUNT(field1) AS Expr1
FROM tbl1
GROUP BY field1
order by expr1 desc
the problem is that i would also like to return a second column that
just so happens to be of text type. mssql2k will not accept a text
type column in the group by clause and i have tried to cast it as a
varchar with no luck. any thoughts?
tia, alex________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

