you can join the first table twice....

select p.name,c1.color AS color1, c2.color AS color2
from  people p LEFT JOIN colors c1 ON p.colorchoice1 = c1.colorID
LEFT JOIN colors c2 ON p.colorchoice2 = c2.colorID


On 2/15/06, J W <[EMAIL PROTECTED]> wrote:
> I am trying to get a query to run and right now my brain is in Monday mode..
>
> Lets say I have 2 tables
>
> Table 1 - COLORS
>
> ColorID   Color
> 1    red
> 2    blue
> 3    green
> 4    tan
>
> Table 2 - PEOPLE
>
> PersonID    Name   colorchoice1   colorchoice2
> 1    Jane   1   3
> 2    Jim     2   4
>
>
> How do I display this from a query:
>
> Jane  red   green
> Jim    blue  tan
>
> ?? I can get one name by using this
>
> select *
> from colors c, people p
> where c.colorchoiceID = p.colorchoice1
>
> That will effectively give me the name of the first color. How in the world
> can I get the second color in ONE query. I can do it in two, but trying to
> use it in CFGRID, you can only use the one. Is it even possible to get in 1?
>
> Thanks,
> Jeff
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232403
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to