|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
select single entry found in all rows (access2k)
I have to write a statement that answers the question:
"Which pilot is authorized to fly all the aircraft in the fleet?" implying that the individual aircraft could be of any of the three aircraft types. Below are the tables with notation Tbl_name (important keys [clarification of keys]): personnel (pers_id, name, crew_role [eg. pilot, stewardess]), aircraft (craft_id, type_designation [eg. Boeing737], craft_name [eg. The Viking, Icarus]), aircraft_type (type_designation), and authorization (pers_id, type_designation). In words my question should be something like: "For all those who are authorized to fly aircraft (the only pers_id:s listed in the authorization table), show the names of those that have their pers_id:s next to all aircraft_type:s." I've gotten this far: Code:
SELECT DISTINCT p.name FROM personnel AS p, authorization AS b, aircraft_type AS f WHERE p.pers_id = b.pers_id AND b.type_designation = ... ; Now what I want to accomplish is to select the pilot which has a record for ALL type_designation entries in the aircraft_type table. Is there a magic keyword that I don't know of? Is that magic keyword called "EXIST" and how do I use it? Best regards, rod |
|
#2
|
||||
|
||||
|
this is homework, right?
go to your nearest library or bookstore and get Joe Celko's SQL for Smarties it's in there |
|
#3
|
|||
|
|||
|
hi!
not quite homework, but yes part of a school project. we have tried a lot of different combinations without getting the desired result, so now after running out of great ideas and with time passing by we therefore we look to help online. =) Quote:
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > select single entry found in all rows (access2k) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|