Cool, thanks!
At 08:02 PM 29/07/02 -0700, you wrote:
>You can simply nest SELECT STATEMENTS:
>
><cfquery name="selTotals" datasource="#Request.Datasource#">
> SELECT (SELECT COUNT(*) FROM Products) As ProductCount,
> (SELECT COUNT(*) FROM Brand) As BrandCount
></cfquery>
>
>Note that you can nest any number of sub-statements in the SELECT
>COUNT()'s, such as a WHERE clause.
>
>----
>SCOTT VAN VLIET
>BRD.WRKS INTERACTIVE
>T: 714.469.6805
>E: [EMAIL PROTECTED]
>
>
>-----Original Message-----
>From: Brook Davies [mailto:[EMAIL PROTECTED]]
>Sent: Monday, July 29, 2002 7:55 PM
>To: CF-Talk
>Subject: SQl Question (aggregate functions)
>
>Is it possible to get the count() from multiple tables in a single
>select
>statement? I want to do something like this to return the count() in
>each
>of the related tables. Eventually, if possible I would like to do a
>couple
>more aggregate functions on these related tables.
>
><cfquery datasource="#datasource#" name="campaign_overview">
>select count(op.id),count(link.id)
>from lfemail_campaign AS c JOIN lfemail_log_openrate op ON
>c.campaignID=op.campaignID
> JOIN lfemail_log_link AS link ON c.campaignID=link.campaignID
>where c.campaignID=#client.campaignID#
></cfquery>
>
>Is this possible? As soon as I add the second join clause, the count is
>oncorrect. Any ideas?
>
>Brook Davies
>
>
>
>
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists