Solved

Reversing an Inner Join

Posted on 2004-08-26
2
351 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
2 Comments
 
LVL 19

Accepted Solution

by:
NickUpson earned 125 total points
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now