By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,045 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Outer Join on 3 tables

P: n/a
I am using Postgres 7.4.6 i have 3 tables i want to join 3 tables and
return a list of route_id to which a specified user_id does NOT belong.
Table "public.vts_users"
Column | Type | Modifiers
------------+------------------------+--------------------------------------
--------------------------
user_id | integer | not null default
nextval('public.vts_users_user_id_seq'::text)
username | character varying(255) | not null
password | character varying(50) |
role_id | integer |
first_name | character varying(50) |
last_name | character varying(50) |
timezone | character varying(3) | default 'MST'::character varying
Indexes:
"vts_users_pkey" primary key, btree (user_id)
"vts_users_username_key" unique, btree (username)
Foreign-key constraints:
"$1" FOREIGN KEY (role_id) REFERENCES vts_roles(role_id)

vtsdev=# \d vts_routes
Table "public.vts_routes"
Column | Type |
Modifiers
--------------------+------------------------+------------------------------
------------------------------------
route_id | integer | not null default
nextval('public.vts_routes_route_id_seq'::text)
route_name | character varying(50) |
route_description | character varying(255) |
always_web_visible | boolean | not null default false
school_id | integer |
Indexes:
"vts_routes_pkey" primary key, btree (route_id)
Check constraints:
"route_name_nn" CHECK (route_name IS NOT NULL)

vtsdev=# \d vts_parent_route_link
Table "public.vts_parent_route_link"
Column | Type | Modifiers
-----------+---------+------------------------------------------------------
------------------------
prlink_id | integer | not null default
nextval('public.vts_parent_route_link_prlink_id_se q'::text)
user_id | integer |
route_id | integer |
Indexes:
"vts_parent_route_link_pkey" primary key, btree (prlink_id)
"vts_parent_route_link_user_id_key" unique, btree (user_id, route_id)
Check constraints:
"user_id_nn" CHECK (user_id IS NOT NULL)
"route_id_nn" CHECK (route_id IS NOT NULL)
Foreign-key constraints:
"$1" FOREIGN KEY (user_id) REFERENCES vts_users(user_id)
"$2" FOREIGN KEY (route_id) REFERENCES vts_routes(route_id)
Nov 25 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.