Skip to Content
Former Member
Sep 11, 2008 at 10:08 AM

Table View double foreign key.



I'm facing a problem about table view. My problem is the following:

I have


Table Car ( id_car, id_color_out, id_color_rims, id_color_bumper, model)

Table Color( id_color, name_color)


So, id_color_out, id_color_rims, id_color_bumper are foreign keys of table color.

In native sql the view was something like this:


select id_car, c1.name_color, c2.name_color, c3.name_color, model

from car inner join

color as c1 on c1.id_color = car.id_color_out inner join

color as c2 on c2.id_color = car.id_color_rims inner join

color as c3 on c3.id_color = car.id_color_bumper


I don't know how to do this in a VIEW. Can anyone help me?

Thanks in advance!

Edited by: Paulo Santos on Sep 11, 2008 12:09 PM