| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Brian Dunning | Date: | November 2 2009 5:09pm |
| Subject: | Re: Trouble joining 3 tables | ||
| View as plain text | |||
Johnny - Your solution might actually help me solve my next step, which is to also return a count of pets bought only within the last 7 days. Something like this: > > SELECT people.*, > SUM(IF(cars.id IS NULL,0,1)) AS car_count, > SUM(IF(pets.id IS NULL,0,1)) AS pet_count, SUM ( IF ( pets.date_bought > NOW() - INTERVAL 7 DAYS, 1, 0 ) AS new_pet_count Yes?
| Thread | ||
|---|---|---|
| • Trouble joining 3 tables | Brian Dunning | 2 Nov |
| • Re: Trouble joining 3 tables | Johnny Withers | 2 Nov |
| • Re: Trouble joining 3 tables | Brian Dunning | 2 Nov |
| • Re: Trouble joining 3 tables | Johnny Withers | 2 Nov |
| • Re: Trouble joining 3 tables | Brian Dunning | 3 Nov |
| • Re: Trouble joining 3 tables | Brian Dunning | 2 Nov |
