How to make my mysql queries for showing friends feeds? -


here table structure.(fun_friends)

id user_id,friend_id,status,createdat,updatedat  1    1        2        1      123456  125461  2    1        3        1      454545  448788  3    2        4        1      565659  898889  4    1        5        1      877878  878788 

here table structure of user_uploads

id  user_id parent_id   category_id title   slug    tags    description video_type  source  video_link  video_thumb  1     2        1              2    fun     fun     ['4','5']  coolvid     1        ytu     link        thumb 

i need show latest upload of friends

can tell me how can join tables together? tried with

select * fun_friends (user_id= '".$_session['user_row_id']."' ,  `status` =1) or (friend_id= '".$_session['user_row_id']."' ,  `status` =1) 

and showing friends of logged-in user

how using union friends user , wrapping inside subquery later join on other tabel,

select  usr.*    user_uploads usr         inner join         (             select  user_id  id                fun_friends               friend_id = 'id_here'             union             select  friend_id id                fun_friends               ser_id = 'id_here'         ) idlist on usr.user_id = idlist.id 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -