|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: Trouble joining 3 tables
From: Johnny Withers (johnny
pixelated.net)
Date: Mon Nov 02 2009 - 13:59:52 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Yes, I don't see why that wouldn't work...
On Mon, Nov 2, 2009 at 11:09 AM, Brian Dunning <brian
briandunning.com>wrote:
> 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?
>
>
--
-----------------------------
Johnny Withers
601.209.4985
johnny
pixelated.net
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]