|
I need to come up with an SQL statement that will compare a set
of values in one tables and find a matching set of rows in
another table. The relationships go like this:
A work order contains 15 fields defined as zoned 4.2 that are
called procedure numbers.
A traveler document has a many to one relationship with the
traveler procedure table. The relevant fields from this table
are traveler ID number and procedure number, defined the same as
in the work order table.
Given a work order number, I need to find all traveler ID numbers
whose related traveler procedure table records match those from
the work order table, including being in the same sequence.
Or in lovely ASCII art:
__________________________________
| WO# | PROC 1 | PROC 2 | PROC 3 |
----------------------------------
| 1 | 1.01 | 1.02 | 1.03 |
----------------------------------
matches:
__________________<ed>_
| TRAV# | PROC | Seq |
----------------------+
| 123 | 1.01 | 1 |
----------------------+
| 123 | 1.02 | 2 |
----------------------+
| 123 | 1.03 | 3 |
-----------------------
So my SQL statement should return "123" as the traveler ID number
that matches the procedures from the given work order number.
I'm not super great at constructing SQL queries, so this might be
super simple, but I haven't been able to come up with anything
that works. Please help me out :)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.