> That doesn't seem to do what I want it to. I modified the
> query to grab just the fields I'm using and grouped by those
> fields:
>
> <CFQUERY name="clicks_per_product_market_display" datasource="#
> Data_Source #">
>             select
> email_blast.embl_email,email_blast.embl_companyname,email_blas
> t.embl_name,email_results.emres_prod_part_numl,email_results.emre
> s_click_date
>
>             from email_results, email_blast
>
>             Where email_results.emres_blast_sent_id = #URL.BLAST# AND
> email_results.emres_prod_catagory = '#get_cat_info.Category#' AND
> email_blas_id = emres_blast_email_id
>
>             Group By
> email_blast.embl_email,email_blast.embl_companyname,email_blas
> t.embl_name,email_results.emres_prod_part_numl,email_results.emre
> s_click_date
>
>             Order By email_blast.embl_companyname
>
>             </CFQUERY>
>
> I still get duplicate data so if person from companyA clicked
> twice on a product the query will show
>
> companyA [EMAIL PROTECTED]
> companyA [EMAIL PROTECTED]
>
> I want companyA to show up only once even if they clicked 5
> times. Does that make sense?

OK. I read your SQL a little more closely this time; I apologize for not
reading it more accurately before. You can only effectively use the GROUP BY
clause when you use aggregate functions within your SELECT statement:

SELECT COUNT(email_blast.embl_email)
FROM ...
WHERE ...
GROUP BY email_blast.embl_email

It looks like what you really want is to select all the data without GROUP
BY, and use the GROUP attribute of CFOUTPUT to display your data:

<cfoutput query="qWhatever" group="embl_email">
#embl_companyname#
<cfoutput>
... repeated data for that company ...
</cfoutput>
</cfoutput>

Alternatively, if you just want to select each item once, you can use
DISTINCT within your query:

SELECT DISTINCT embl_email ...

I'm not sure exactly which outcome you want, though.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to