Every column you select that is not in an aggregate function (sum(),
count(), avg() etc.) must be in the group by clause.


-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 16, 2002 2:20 PM
To: CF-Talk
Subject: select more columns


How do I select more columns from within this query?

<cfquery name="getsomedata" datasource="log_stats">
select URL count(url) as 'visits'
from log_data
group by url
order by visits desc
</cfquery>

I want to get the date and ip columns but get a syntax error when I add the
fields after the Select statement as:

select logdate, ip, URL count(url) as 'visits'

Thanks.

Robert O.
HWW

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to