Martin Thorpe said:
>
> org_type | year |    d_1      |      d_2     |    d_3
> adm        2004   01/01/2004     22/06/2004     12/12/2004
> adm        2006   31/01/2006     12/05/2006     12/12/2006
>
> What I want to get is d_2 and d_3 for all orgs for one year and d_1
> for all orgs for another year, all in one row.  so the results would
> look something like this something like this
>
> adm - d_1(where year = 2006) - d_2(where year = 2004) - d_3(where
> year = 2004)

SELECT
    org_type,
    y_old.d_1,
    y_old.d_2,
    y_new.d_3
FROM
    table y_old
        JOIN
    table y_new
        USING (org_type)
WHERE
    y_old.year = 2004
    AND
    y_new.year = 2006

Jochem




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232692
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to