-
How to Fetch Recent Activity as Newsfeed for Social App in MySQL PHP
over 7 years ago
-
over 7 years ago
Hi,
A per your requirement, I am writing a query.(SELECT u.u_id, f_name, l_name,dp,p.p_date as post_date,'post_activity' from users u,friends f,posts p where u.u_id=receiver_id and f.sender_id=login_user_id and f.receiver_id=p.u_id) UNION (SELECT u.u_id, f_name, l_name,dp,p.time as post_date,'page_like_activity' from users u,friends f,page_like p where u.u_id=receiver_id and f.sender_id=login_user_id and f.receiver_id=p.who_liked) order by post_date desc
u_id f_name l_name dp post_date Ascending post_activity 4 I J 2017-05-24 02:03:00 post_activity 3 E F 2017-05-24 00:00:00 page_like_activity 3 E F 2017-05-24 00:00:00 post_activity
-
1 Answer(s)