Greetings,

 

I'm facing a difficult query at the moment. I have tried many different
queries but still not get the desired result. 

 

My case:

 

Tables:

 

shipped ( id, shipdate, sn);

undelivered (id, undate, sn);

return (id, redate, sn);

 

 

 

I need the following output:

 

DATE       SHIPMENTS UNDELIVERED RETURNS

Fri 1 may 2005          87                  11                  4

Sat 2 may 2005          82                  17                  5

...                        ..                    ...                 ...

 

 

 

So far, Im have succesfulyl manage to get the result using just one
table:

 

DATE       SHIPMENTS 

Fri 1 may 2005          87           

Sat 2 may 2005          82           

...                        ..                    

 

 

   

With the query:

 

SELECT DATE_FORMAT(shipdate,'%a %e %b %Y'),

COUNT(shipdate) 

FROM shipped

WHERE (YEAR(shipdate) = 2004) AND (MONTH(shipdate) = 05) 

GROUP BY shipdate

 ORDER BY shipdate DESC

 

 

However, joining the 3 tables and getting the right results is being a
nightmare. I have already tried different left and right joins, with no
success. Please any help, hints, or light on the query will be greately
appreciated.

 

James.

 

 

Reply via email to