nts.DeptID = UserDept.DeptID
GROUP BY Departments.DeptID, Departments.DeptName
ORDER BY DeptName DESC;
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 12, 2004 6:39 AM
> To: Daevid Vincent
> Cc: [EMAIL PROTECTED]
> Subje
|
| Subject: How can I count() on multiple tables in a single query?
|
>
Using mysql v4.0.x on linux.
Given three tables...
CREATE TABLE Departments (
DeptID int(10) unsigned NOT NULL auto_increment,
DeptName char(30) default NULL,
PRIMARY KEY (DeptID)
)
CREATE TABLE UserDept (
CoreID int(10) unsigned NOT NULL default '0',
DeptID int(10) unsigned NOT NULL
ph [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 10:33 AM
To: Mike Hillyer; [EMAIL PROTECTED]
Subject: RE: Count on Multiple Tables
CREATE TABLE `affiliate_clickthroughs` (
`affiliate_clickthrough_id` int(11) NOT NULL auto_increment,
`affiliate_id` int(11) NOT NULL default '0
ng_status` int(5) NOT NULL default '0',
`payment_date` datetime NOT NULL default '-00-00 00:00:00',
`commission_percent` decimal(4,2) NOT NULL default '0.00',
PRIMARY KEY (`affiliate_orders_id`)
) TYPE=MyISAM;
-Original Message-
From: Mike Hillyer [mailto:[EMAI
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,
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 d