Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP WITH A QUERY......PLEASE !!!

Status
Not open for further replies.

NewComer

Technical User
Apr 26, 2001
35
0
0
US
We collect maintenance data on aircraft. Each aircraft is assigned a serial number called BUNO. When receiving maintenance it goes through different phases, we refer to as 1 PMI, 2 PMI, 3 PMI and Baseline. The query I am developing only wants to look at BUNO's that have gone through maintenance more than once. That part I was able to do with no problem. Also in the report is TASK, this records the various maintenance operations and each of these have unique TASK NUMBERS. Some of the TASKS are not performed in every maintenance phase, some are. Now the part I don't know, what I want the query to return for each BUNO only the task that occur in both phases (utilizing the phase field). Any ideas would certainly be helpful. I just don't know how to write the SQL to take each individual BUNO knowing that it has recieved maintenance in atleast 2 phase, then look at the task number and if the same task was performed in both phases, return the buno, phase, task no, and the count of hits otherwise omit from report. Thanks for your help in advance.
 
Use a subquery to compare the task values. A rough example below (gotta get back to work)

Code:
Select BUNO, phase1.Task, phase2.Task Where phase1.Task in (Select BUNO, phase2.Task)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top