Google Answers Logo
View Question
 
Q: Simple SQL Query ( No Answer,   2 Comments )
Question  
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

Request for Question Clarification by lazerfx-ga on 20 Oct 2005 06:11 PDT
Hi,
Unfortunately, the linked images are not linking to images.

When you say you want pointID's that are not inspected, are you
looking for items in tblInspectionRound that don't have a
corresponding ID in tblInspectionPoint?

Thanks in advance,

LazerFX-ga
Answer  
There is no answer at this time.

Comments  
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.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

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 Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy