473,765 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Outer Join on 3 tables

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_use rs"
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'::characte r varying
Indexes:
"vts_users_pkey " primary key, btree (user_id)
"vts_users_user name_key" unique, btree (username)
Foreign-key constraints:
"$1" FOREIGN KEY (role_id) REFERENCES vts_roles(role_ id)

vtsdev=# \d vts_routes
Table "public.vts_rou tes"
Column | Type |
Modifiers
--------------------+------------------------+------------------------------
------------------------------------
route_id | integer | not null default
nextval('public .vts_routes_rou te_id_seq'::tex t)
route_name | character varying(50) |
route_descripti on | character varying(255) |
always_web_visi ble | boolean | not null default false
school_id | integer |
Indexes:
"vts_routes_pke y" primary key, btree (route_id)
Check constraints:
"route_name _nn" CHECK (route_name IS NOT NULL)

vtsdev=# \d vts_parent_rout e_link
Table "public.vts_par ent_route_link"
Column | Type | Modifiers
-----------+---------+------------------------------------------------------
------------------------
prlink_id | integer | not null default
nextval('public .vts_parent_rou te_link_prlink_ id_seq'::text)
user_id | integer |
route_id | integer |
Indexes:
"vts_parent_rou te_link_pkey" primary key, btree (prlink_id)
"vts_parent_rou te_link_user_id _key" unique, btree (user_id, route_id)
Check constraints:
"user_id_nn " CHECK (user_id IS NOT NULL)
"route_id_n n" 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(rout e_id)
Nov 25 '05 #1
0 4437

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
11697
by: Dave | last post by:
Hi I have the following 4 tables and I need to do a fully outerjoin on them. create table A (a number, b number, c char(10), primary key (a,b)) create table B (a number, b number, c char(10), primary key (a,b)) create table C (a number, b number, c char(10), priamry key (a,b)) create table D (a number, b number, c char(10), priamry key (a,b)) In oracle 9i, the following query returns correct results set, if I were to
8
4974
by: Matt | last post by:
Hello I have to tables ar and arb, ar holds articles and a swedish description, arb holds descriptions in other languages. I want to retreive all articles that match a criteria from ar and also display their corresponding entries in arb, but if there is NO entry in arb I still want it to show up as NULL or something, so that I can get the attention that there IS no language associated with that article.
4
4871
by: thilbert | last post by:
All, I have a perplexing problem that I hope someone can help me with. I have the following table struct: Permission ----------------- PermissionId Permission
3
10054
by: Dam | last post by:
Using SqlServer : Query 1 : SELECT def.lID as IdDefinition, TDC_AUneValeur.VALEURDERETOUR as ValeurDeRetour FROM serveur.Data_tblDEFINITIONTABLEDECODES def, serveur.Data_tblTABLEDECODEAUNEVALEUR TDC_AUneValeur where def.TYPEDETABLEDECODES = 4
7
31564
by: Steve | last post by:
I have a SQL query I'm invoking via VB6 & ADO 2.8, that requires three "Left Outer Joins" in order to return every transaction for a specific set of criteria. Using three "Left Outer Joins" slows the system down considerably. I've tried creating a temp db, but I can't figure out how to execute two select commands. (It throws the exception "The column prefix 'tempdb' does not match with a table name or alias name used in the query.")
3
19477
by: Martin | last post by:
Hello everybody, I have the following question. As a join clause on Oracle we use " table1.field1 = table2.field1 (+) " On SQL Server we use " table1.field1 *= table2.field1 " Does DB2 have the same type of operator, without using the OUTER JOIN syntax ?
4
8859
by: Anthony Robinson | last post by:
I was actually just wondering if someone could possibly take a look and tell me what I may be doing wrong in this query? I keep getting ambiguous column errors and have no idea why...? Thanks in advance!!! SELECT AIM.AIMRETRIEVAL.AIMRETRIEVALID, AIM.AIMRETRIEVAL.DESCRIPTION, AIM.ARCHIVERETRIEVAL.ARCHIVERETRIEVALID, AIM.ARCHIVERETRIEVAL.STATUSID,
2
4675
by: dskillingstad | last post by:
I would really appreciate someone's help on this, or at least point me in the right direction.... I'm working on a permit database that contains 12 tables, and rather than list all of the tables, I'll just list a few, as the links are the same for all tables. These tables are: tblPermitMain tblApplicant tblContractor tblEngineer
2
1811
by: Notgiven | last post by:
I have three tables: table1: table2_ID table3_ID complete table3: table3_ID name
3
49497
by: nico3334 | last post by:
I currently have a query that Joins 2 Tables (Table1 and Table2) using LEFT OUTER JOIN. Here is an example of that query: SELECT a.supply, a.state, b.cost FROM Table1 a LEFT OUTER JOIN Table2 b ON a.supply = b.supply AND a.state = b.state
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8832
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5276
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.