Jump to content

Inner join


violinrocker

Recommended Posts

I wanted to do something like the code below

$str = "SELECT news_feed.*, friends.*, articles.*
FROM 
news_feed
  INNER JOIN articles
   ON news_feed.name = anime.name  OR inner join friends on news_feed.name = friends.friendname
WHERE friends.username = '$name' or articles.subscriptor = '$name'";

 

what its supposed to do is check the tables "articles" and "friends" and check if they are related to the $name (i.e. $name is a friend of $friendname or $name is subscribed to this article) and then get the items from news_feed that $name's friends and the articles he is subscribed to posted

Link to comment
https://forums.phpfreaks.com/topic/235668-inner-join/
Share on other sites

what I want to do is something like... i want to get rows from the news_feed that my friends and articles i subscribed to posted... but the only way to determine if i am friends with the one who posted or if i am subscribed to that article is checking 2 different tables.... so its sorts like "news_feed INNER JOIN ON friends OR articles" and not joining 3 tables

Link to comment
https://forums.phpfreaks.com/topic/235668-inner-join/#findComment-1211447
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.