> mysql Ver 12.22 Distrib 4.0.20, for mandrake-linux-gnu (i586)
With 4.1, it might have been a little easier using some subqueries.
But with 4.0, I don't think we can get the results you're looking for
in a single query, without some really nasty setup. Part of the issue
is that we need to join
of conditions (like where clausules)
James
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 12 August 2005 16:41
To: [EMAIL PROTECTED]
Cc: James M. Gonzalez; mysql@lists.mysql.com
Subject: Re: Complex query. (It's killing me)
Sorry - I think you need a
-Original Message-
From: James M. Gonzalez
Sent: 12 August 2005 16:58
To: 'Scott Noyes'
Subject: RE: Complex query. (It's killing me)
Sorry, I will explain myself more clearly:
Everyday, we ship packages, and we also receive some packages.
The one we receive, has bee
Sorry - I think you need a LEFT JOIN or it won't count shipments which are
not returned.
Alec
[EMAIL PROTECTED]
12/08/2005 16:38
To
[EMAIL PROTECTED]
cc
mysql@lists.mysql.com
Subject
Re: Complex query. (It's killing me)
Just in the spirit of refining my own skills, her
Just in the spirit of refining my own skills, here is how I would tackle
the problem. It parses, but I haven't populated the tables so I don't know
if it works:
SELECT s.dateshipped, COUNT(r.type="undelivered"), COUNT(r.type =
"customer"), COUNT(r.status="open")
FROM shipments s JOIN returns r
> Shipped Undelivered Returned Open
> 12/8/2005 143 3 3
Does this mean of the 14 shipped on 12/8/2005, 3 were returned at some
later date, or does it mean that you shipped 14 on 12/8/2005, and on
that same day 3 unrelated shipments came back, each of which co