We help IT Professionals succeed at work.

Need view to compare Muliple rows in table 1  to multiple rows in table 2 and give one result

213 Views
Last Modified: 2012-05-05
I have two tables. One table contains records where a unique item (x) may associate with several bits. I have another table which assoicates thost bits with a seperate unique code (x'). For example:

tbl1                 tbl2
a 1                  x  1
a 2                  x  2
a 3                  y 1
a 4                  y 2
a 5                  y 3
b 1
b 2
c 1
c 2
c 3
What I'd like to have is a veiw that tells me x is a b because of its combination and y is a c because of its combination, but niether are a because of the required combination. I haven't been able to figure out how to put the view together and I'm hoping it's just a mental margarita on my part. Any ideas?
Comment
Watch Question

CERTIFIED EXPERT
Awarded 2008
Awarded 2008
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Scott PletcherSenior DBA
CERTIFIED EXPERT
Most Valuable Expert 2018
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Awarded 2008
Awarded 2008

Commented:
That was actually the first time I'd used  checksum_agg

Author

Commented:
That's a nifty way of doing it that I haven't seen before. The problem is the actual data in question are all string fields.

Author

Commented:
I probably put a bad example in the inital question. Here's a more realistic situation:

tbl1 has multiple Orders. Each Order has mulitple Samples. Each sample has multiple tests defined by a unique three field combination, so a row in table one looks like:

tbl1
Order  Sample     Group     Test   Method
1234   1234-001  Group1  Test1 Method1
1234   1234-001  Group1  Test2 Method1  

tbl2 defines our billing code for combinations of test and method. Some test/methods are grouped together for billing purpose, so we get something like

tbl2
TestCode  Group     Test   Method
A1             Group1  Test1 Method1
A2             Group1  Test1 Method1
A2             Group1  Test2 Method1


In this situation, order 1234 needs to be billed out as 1 A2. The structure of tbl1 is set, but if needed I can change the way tbl2 is set up. Sorry for the confusion. Is this possible?

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.