Re: 2 Joins in 1 Query

2005-05-24 Thread SGreen
"shaun thornburgh" <[EMAIL PROTECTED]> wrote on 05/24/2005 07:35:03 AM: > >From: [EMAIL PROTECTED] > >To: "shaun thornburgh" <[EMAIL PROTECTED]> > >CC: mysql@lists.mysql.com > >Subject: Re: 2 Joins in 1 Query > >Date: Mon, 23 May 2

Re: 2 Joins in 1 Query

2005-05-24 Thread shaun thornburgh
From: [EMAIL PROTECTED] To: "shaun thornburgh" <[EMAIL PROTECTED]> CC: mysql@lists.mysql.com Subject: Re: 2 Joins in 1 Query Date: Mon, 23 May 2005 12:20:05 -0400 "shaun thornburgh" <[EMAIL PROTECTED]> wrote on 05/23/2005 10:18:29 AM: > Hi, > > T

Re: 2 Joins in 1 Query

2005-05-23 Thread SGreen
Cut and paste bites me again. The portion (cut out accidentally) should have been: FROM Weeks w LEFT Bookings b on WEEK(b.Booking_Start_Date) = w.Week_Number LEFT JOIN Projects p ON p.Project_Id = b.Project_ID sorry all! Shawn [EMAIL PROTECTED] wrote on 05/23/2005 12:20:05 PM:

Re: 2 Joins in 1 Query

2005-05-23 Thread SGreen
"shaun thornburgh" <[EMAIL PROTECTED]> wrote on 05/23/2005 10:18:29 AM: > Hi, > > The following query produces the number of bookings per project grouped by > week: > > SELECT WEEK(Booking_Start_Date) AS "WEEK", > SUM(IF(B.Project_ID = "23", 1,0)) AS `Project A`, > SUM(IF(B.Project_ID = "42",

Re: 2 Joins in 1 Query

2005-05-23 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "shaun thornburgh" <[EMAIL PROTECTED]> writes: > Hi, > Unfortunately that doesnt work, I need to LEFT JOIN Bookings to Weeks > but keep the current join on Projects there as well, any ideas? So what you would need is something like that: Weeks LEFT JOIN (Bookings

RE: 2 Joins in 1 Query

2005-05-23 Thread Peter Normann
shaun thornburgh wrote: > Unfortunately that doesnt work, I need to LEFT JOIN Bookings to Weeks > but keep the current join on Projects there as well, any ideas? Sorry, Shaun. I misunderstood what you were trying to accomplish first. How about something along these lin

RE: 2 Joins in 1 Query

2005-05-23 Thread shaun thornburgh
Hi, Unfortunately that doesnt work, I need to LEFT JOIN Bookings to Weeks but keep the current join on Projects there as well, any ideas? From: "Peter Normann" <[EMAIL PROTECTED]> To: "'shaun thornburgh'" <[EMAIL PROTECTED]>, Subject: RE: 2 Joins

RE: 2 Joins in 1 Query

2005-05-23 Thread Peter Normann
shaun thornburgh wrote: > SELECT WEEK(Booking_Start_Date) AS "WEEK", > SUM(IF(B.Project_ID = "23", 1,0)) AS `Project A`, > SUM(IF(B.Project_ID = "42", 1,0)) AS `Project B` > FROM Bookings B INNER JOIN Projects P USING (Project_ID) > WHERE B.Booking_Type = "Booking" > AND

2 Joins in 1 Query

2005-05-23 Thread shaun thornburgh
Hi, The following query produces the number of bookings per project grouped by week: SELECT WEEK(Booking_Start_Date) AS "WEEK", SUM(IF(B.Project_ID = "23", 1,0)) AS `Project A`, SUM(IF(B.Project_ID = "42", 1,0)) AS `Project B` FROM Bookings B INNER JOIN Projects P USING (Project_ID) WHERE B.Bo