[eluser]rich.a.coy[/eluser]
Thanks for your encouraging words. I have learned a lot in the past month by working on this project.
The code below is working and getting me 95% of where I need to be however I have complicated things a little more by having friendship levels. For example "friends" are a subset of "acquaintances".
I have a field in the friendships table called "level" and a field in the posts table called "viewable" that I need to compare. So somehow I need to add something like the following to the query:
Code:
AND if friendship.level = "f" or if friendship.level = "a" AND post.viewable = "a"
I have tried to add that after the WHERE clause below but I get a lovely SQL syntax error.
Here is what I have so far in my model:
Code:
SELECT * FROM (friendships LEFT JOIN user_profiles on friendships.member2 = user_profiles.user_id)
LEFT JOIN posts ON friendships.member2 = posts.user_id
WHERE friendships.member1 = '1'
ORDER BY posts.date DESC
I know I could do a comparison in the view and just not display the posts they are not supposed to see but my result set would then be bloated and not accurate.
Thanks again for your help.
Rich