![]() |
|
|
| Subject:
Simple SQL Query
Category: Computers > Programming Asked by: alitech-ga List Price: $10.00 |
Posted:
19 Oct 2005 12:01 PDT
Expires: 20 Oct 2005 06:53 PDT Question ID: 582211 |
I want to create a view that uses these tables tblPoint, tblInspectionPoint, tblInspectionRound ( http://fwhome.hopto.org/~arezafar/schema.jpg ) and lists all the inspectionRoundIDs and the pointIDs that do not have a corresponding inspectionPointID. Example with sample data http://fwhome.hopto.org/~arezafar/sample.jpg Basicly There are Rounds, for each Round there are couple of Points. Each time an inspection is started a new row is added to tblInspectionRound and for each Point inspected (belonging to the Round being inspected) we add a row to tblInspectionPoint. So I want a list of inspectionRoundIDs and the pointIDs which are NOT inspected (so they do not have a row in tblInspectionPoint with that inspectionRoundID). Thanks, Ali | |
|
|
| There is no answer at this time. |
|
| Subject:
Re: Simple SQL Query
From: monic_b-ga on 19 Oct 2005 15:52 PDT |
Hello Ali,
Try the following query and let me know:
select a.pointid, b.inspectionround inspectionroundid
from tblpoint a,
tblinspectionround b
where a.roundid = b.roundid(+)
and not exists
(select 1
from tblinspectionpoint c
where c.pointid = a.pointid)
UNION
SELECT a.pointid ,b.inspectionround inspectionroundid
from tblinspectionround b,
tblpoint a
where b.roundid = a.roundid (+)
and not exists
(select 1
from tblinspectionpoint c
where c.inspectionroundid = b.inspectionround
and c.pointid = a.pointid) |
| Subject:
Re: Simple SQL Query
From: alitech-ga on 19 Oct 2005 16:22 PDT |
Thanks monic_b, this was the answer I was looking for. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
| Search Google Answers for |
| Google Home - Answers FAQ - Terms of Service - Privacy Policy |