Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

2 relationships between 2 tables - how can i query and return the correct results?

Posted on 2004-10-01
2
Medium Priority
?
211 Views
Last Modified: 2006-11-17
Two tables involved in this particular query:
STATUS and METHOD
in Status table, there are two fields that refer to the primary key of method table, as the status table is trying to catch how something was received and also how something was sent out. eg. sent out via courier, and returned via fax, for example.

I do not know how to write the SQL statement to bring back the correct results as it seems to be bringing back "Fax for both sent and received method, even though the sent method in the database is clearly courier.

Any one have any ideas?

The join looks like this:
STATUS join Method on Method.methodid = status.sentmethod
and Method.methodid = status.receivedmethod

I know this is not correct, but don't know how to resolve this....

Looking forward to your responses.

Peter
0
Comment
Question by:PeterL32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
ATAHAC earned 1000 total points
ID: 12203363
try his :
STATUS join Method m1 on m1.methodid = status.sentmethod
join Method m2 on m2.methodid = status.receivedmethod
0
 

Author Comment

by:PeterL32
ID: 12216288
Thanks so much, that works wonderfully!!!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question