Here is what I am trying to do and I am not sure how to do it.
This is the SQL I am using right now:
SELECT p.id, p.prop_name, o.id as record_id, o.greeter, o.greet_access, c.id AS greet_id, c.cname, c.fname, c.lname
FROM prop_info p
LEFT JOIN owner_info o ON p.id=o.prop_num
LEFT JOIN contact_list c ON o.greeter=c.id
WHERE p.book_active=1 AND p.listing_type !=2
ORDER BY p.prop_name
so basically pulling a bunch of data from a bunch of different tables that relate to each other but the problem I have is that I need to pull more than 1 set of the c.cname, c.fname, c.lname since there are more than 1 set of numbers in other tables that relate to that information.
I do not know how to do that, can someone please offer some advice?
Thanks in advance!
join that table again, but name it different, like c1 or g (as in greeter) for this one and make other similar abbreviations for those fields. of course, then match on that other field in the ON part in the join.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
A thousand thank yous! That works perfectly! Warm fuzzy feelings :-) I am so happy that I know how to do that now!
BTW here is the resulting SQL
SELECT p.id, p.prop_name, o.id as record_id, o.greeter, o.greet_access, c.id AS greet_id, c.cname, c.fname, c.lname, t.id AS sign_up_id, t.fname AS sign_up_fname, t.lname AS sign_up_lname
FROM prop_info p
LEFT JOIN owner_info o ON p.id=o.prop_num
LEFT JOIN contact_list c ON o.greeter=c.id
LEFT JOIN sign_ups s ON s.prop_num=p.id
LEFT JOIN contact_list t ON s.sign_up_by=t.id
WHERE p.book_active=1 AND p.listing_type !=2
ORDER BY p.prop_name
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks