MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 8th, 2004, 05:38 PM
rawd rawd is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 2 rawd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old September 9th, 2004, 09:00 AM
r937's Avatar
r937 r937 is online now
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,700 r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 6 Days 17 h 21 m 2 sec
Reputation Power: 986
this is homework, right?

go to your nearest library or bookstore and get Joe Celko's SQL for Smarties

it's in there
__________________
r937.com | rudy.ca

Reply With Quote
  #3  
Old September 13th, 2004, 08:06 AM
rawd rawd is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 2 rawd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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:
Originally Posted by r937
this is homework, right?

go to your nearest library or bookstore and get Joe Celko's SQL for Smarties

it's in there

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > select single entry found in all rows (access2k)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway