This is myquery in these query i have fetch the result from 4 tables using inner join.It return all the records which are matched from 4 tables. But i want to also get that reords which are matched in fl_customer_profile table and fl_users table.And also get that records which ids are matched in 4 tables.
SELECT u.*,c.*,s.*,p.*
FROM fl_users u
INNER JOIN fl_customer_profile c
on u.id = c.userID
INNER JOIN fl_customer_subscription s
on u.id = s.userid
INNER JOIN fl_subscription p
on s.planId = p.id
fl_users Table
ID
| 879 |
| 884 |
fl_customer_profile Table
userID
| 879 |
| 884 |
I guess your are trying to get all the records that matches fl_customer_profile and fl_users whether they are present in other tables or not, Inner join will return records if they are present in both tables , while left join will return all records from left table and from second table will return only matched rows
SELECT u.*,c.*,s.*,p.*
FROM fl_users u
INNER JOIN fl_customer_profile c
on u.id = c.userID
LEFT JOIN fl_customer_subscription s
on u.id = s.userid
LEFT JOIN fl_subscription p
on s.planId = p.id
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.