Solved

Reversing an Inner Join

Posted on 2004-08-26
2
383 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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…

735 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