A query really sucks the whole day:(..I am getting a problem while fetching query result.
Scenario: I have two tables where in first table I saved user activity details and second table is used to saves likes functionality of users of all activities entered by other users.
What I need is that to fetch like value whether current logged in user already liked activity or not. I need some sort of boolean value.
Table to store activities
Table to store like count
What I need to check that distinct activity wise logged-in user like check . Tried Query :
SELECT at.id, CASE WHEN lk.status =1 and lk.user_id = 6 THEN 1 ELSE 0 END AS l FROM activity_transactions at LEFT JOIN likes lk ON at.id = lk.activity_transaction_id
Guys any solution?? The problem is, I am getting duplicate rows. I need to check 1 if users are liked else 0 for other activity rows.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire