php - Multiple tables, multiple statement -


Let's take three tables in which there are rows of all the tones:

  table posts Postpid Post UID PostText Tab User's User UID User Name Table Favorite Favorites UID Favorite PID   

Now, to get all the latest posts, such as I do a query:

  SELECT p.PostPID, P.PostUID, p. Post Text, U.U.U.RUID, U.J.S.N.O. Posts as posts in the form of a user. Post UID = U. User uid order p. POPPID DESC Sirius 0, 30   

Which works fine? Now I was wondering, how do I get only one specific user ID? Therefore only a preferred UID = USERUID = X

You can use a subquery .

  ... where in p.PostUID (select f.FavoritePID from the preferred f where f.FavoriteUID = UserUID) ...    

Comments