Actually MAX works in QofQ. I'd use that instead of maxrows:

<cfquery name="foo" dbtype="query">
select max(something) as maxvalue from somequery
</cfquery>

On Tue, Sep 23, 2008 at 6:14 PM, s. isaac dealey <[EMAIL PROTECTED]> wrote:
>> <cfquery name="PartyConstituencyResults" datasource="#request.datasource#">
>>
>> SELECT c.ConstituencyName, s.ConstituencyNo, v.Party, Sum(v.Votes) AS 
>> TotalVotes
>> From (Constituency c
>> INNER JOIN PollingStation s ON c.ConstituencyNo = s.ConstituencyNo)
>> INNER JOIN VoteResults v ON s.AgentPhoneNo = v.AgentPhoneNo
>> WHERE v.ResultCategory = 'L' AND s.ConstituencyNo IN (Select ConstituencyNo 
>> From Constituency)
>> Group By c.ConstituencyName, s.ConstituencyNo, v.Party
>> Order By c.ConstituencyName
>>
>> </cfquery>
>
> After this query, add a query of query that gets the top 1 record sorted
> by totalVotes desc:
>
> <cfquery name="WinningConstituency" dbtype="query" maxrows="1">
>        select * from PartyConstituencyResults
>        order by TotalVotes desc
> </cfquery>
>
> That oughta do it. :)
>
> hth
>
> --
> s. isaac dealey  ^  new epoch
>  isn't it time for a change?
>     ph: 781.769.0723
>
> http://onTap.riaforge.org/blog
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:313017
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to