Table : Post
id user_id group_id Text
1 1 1 AAA
2 2 2 BBB
3 2 2 CCC
4 3 2 DDD
5 2 3 EEE
Table : UserMaster
user_id username
1 Raj
2 Meet
3 Kishan
Table : Groups
group_id groupname
1 JAVA
2 PHP
3 SEO
Table : JoinRequest
id user_id group_id status
1 1 3 deactive
2 2 2 active
3 2 1 active
4 1 3 active
My Query Here:
//Help me improve my query to get the desired result.
select * FROM Post
where status = active in JoinRequest table
and user_id=’2′
Expected Result :
id username Groupname Text
1 Raj JAVA AAA
2 Meet PHP BBB
3 Meet PHP CCC
4 Kishan PHP DDD
3
Answers
You can get your result like this.