How to stop null fields from filling with data [message #374013] |
Sat, 19 May 2001 11:46 |
Chris Rhine
Messages: 2 Registered: May 2001
|
Junior Member |
|
|
I have 4 tables Person, Contact, Student and Company
I want to list all of the Persons that live in the state 'PA' (Contact and Student both have a foreign key "PersonID" which is also their primary key). Also, if the contact has a company associated with them, I want it to display that company name. However, when I attempt to combine all of the people, Oracle fills ALL of thecompany names next to EACH student. This returns a crapload of results. I would like this column to show up blank for the student but I can't figure out how. Is there any command which works like this?
THis is my current query:
select distinct p.lname, c.name
from person p, company c, contact ca, student s
where state = 'PA' AND c.companyID = ca.companyID AND ca.personID = p.personID OR s.personID = p.personID;
Any help is appreciated.
|
|
|
|
|
|
|
|
|