Solved

Reversing an Inner Join

Posted on 2004-08-26
2
391 Views
Last Modified: 2006-11-17
I have a query that looks like this:

SELECT fname, member.id, filename, friendID,memberFriends.memID, statusID
FROM MEMBER
INNER JOIN memberFiles on member.id = memberfiles.memID
INNER JOIN memberFriends on member.id = memberFriends.friendID
WHERE memberFriends.memID = 19 OR memberFriends.FriendID = 19
AND ID != 19

Basically, it establishes a relationship between two members. It works, returning the "friends" of the member who
s ID is specified. The problem is that when their friend's profile is accessed that member does not show up in the query.

In other words, I need to be able to find all members who friendID matches a memberID, which is the reverse of what this query produces.

Does that make sense?

-- Jenni
0
Comment
Question by:JenniQ
[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 19

Accepted Solution

by:
NickUpson earned 125 total points
ID: 11913031
Please post the table structure for all the tables?
Is the memberFiles table needed to achieve your description for the current query?

I think this does what you want but I may have misunderstood the situation

select m.id, m.fname from memberfrends mf
inner join member m on mf.memid = m.id
where mf.friendid = 27
0
 
LVL 3

Author Comment

by:JenniQ
ID: 11917737
That query does find what I was asking, but I was looking for a query that produced that result along with the results of my previous query. I think I need to rethink the way this works. Thanks for your help!

-- Jenni
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

623 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