Can you show some table structure so we have something work with? It's
hard to recommend a query when we do not know what your sales table
structure is.

Regards,
Mike Hillyer
www.vbmysql.com


-----Original Message-----
From: Ralph [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 04, 2003 4:00 PM
To: [EMAIL PROTECTED]
Subject: Count on Multiple Tables


I've been stuck on this one all morning. Can't seem to figure it out.

I have 2 tables, one with affiliate sales and another with affiliate
clickthroughs. I have to query both tables, so that I can get
clickthrough dates, hits, and then query affiliate sales table to get
number of orders for each date. I want to display the results like this:

DATE          | TOTAL HITS | TOTAL SALES
05/03/2003           6           1
05/04/2003           7           0

 
I've managed to get dates and total hits by using the following query:

SELECT DATE_FORMAT(affiliate_clientdate, '%M %D, %Y') AS date, COUNT(*)
AS hits FROM affiliate_clickthroughs WHERE affiliate_id = '111' AND
affiliate_stores_id = '123' AND MONTH(affiliate_clientdate) = '06' AND
YEAR(affiliate_clientdate) = '2003' GROUP BY date";

But then I can't get the total number of sales on affiliate sales table.

Any suggestions? Your help is greatly appreciated.



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to