Wanna fetch data from 3 tables by mysql query to display in feed. But stack. My query is
SELECT f.leaderId, f.followerId, c.ccId, c.ccTitle, c.ccCity, c.ccCountry, c.ccFlag, c.uId, c.ccStartingDate, c.ccCreatedAt, l.uId, l.ccId
FROM followingrelations f, conferencecreate c, likesbyuser l
WHERE f.followerId = 'login_user_id'
AND c.uId = f.leaderId
AND c.ccFlag = 1
AND c.ccStartingDate >= 'current_time_and_date_now'
OR l.uId = f.leaderId
GROUP BY c.ccTitle
ORDER BY c.ccId DESC;
Expectation:
Want to fetch data where
uId
andleaderId
are matched fromfollowingrelations
andconferencecreate
tables respectively.Beside above condition, want to fetch data also if any user likes any post. The condition I putted like this way
OR l.uId = f.leaderId
Am I on right track?
I implemented this query but nothing displaying. Any idea how to solve this issue plz?
My database design is in following:
SELECT ... FROM table1 INNER JOIN table2 ON table1.id = table2.id INNER JOIN table 3 ON table1.id = table3.id WHERE ...
in order to clarify your query because it's impossible to understand what your different WHERE-clauses do (joining or filtering ?)