Forums
This topic is locked
Help with JOIN
Posted 09 Feb 2002 20:05:39
1
has voted
09 Feb 2002 20:05:39 Pablo Deeleman posted:
Hello!I´ve got a problem i cannot solve by myself. I have two tables: MEMBERS, with information of members from an on-line community, and PHOTOS, including filenames and other stuff of self-portrait photos that are uploaded by MEMBERS to the server.
I want to display a table including the full list of members while showing the photo of those who have uploaded an image. For those who don´t, i display a default image.
To do this, i perform the following SQL statement:
SELECT MEMBERS.Name, MEMBERS.Country, MEMBERS.City, PHOTOS.filename FROM MEMBERS LEFT JOIN PHOTOS ON MEMBERS.Name = PHOTOS.Name
I use LEFT JOIN to include ALL records from MEMBERS and only those records in PHOTOS where there´s an equivalent in MEMBERS.
Then i use a table and a repeat region to display the output list. Everything works perfectly, but the community members can upload up to three photos to the PHOTOS table, so if there is somebody that has uploaded 2 or 3 photos, his/her row is displayed 2 or 3 times, and i want him/her to show up just once.
Any help out there?
P. Deeleman
www.deelemanonline.net
Replies
Replied 21 Feb 2002 22:33:43
21 Feb 2002 22:33:43 Fredrik Vestin replied:
use the DISTINCT predicate
Replied 10 Mar 2002 09:32:16
10 Mar 2002 09:32:16 frog jumps replied:
<font face='Tahoma'>Frede
Can you explain this further...I have a similar problem:
www.udzone.net/forum/topic.asp?TOPIC_ID=16526&FORUM_ID=13&CAT_ID=5&Topic_Title=Multiple+Table+Query&Forum_Title=SQL
</font id='Tahoma'>
Can you explain this further...I have a similar problem:
www.udzone.net/forum/topic.asp?TOPIC_ID=16526&FORUM_ID=13&CAT_ID=5&Topic_Title=Multiple+Table+Query&Forum_Title=SQL
</font id='Tahoma'>