fixed query error when user has not reacted to post
This commit is contained in:
@@ -73,7 +73,7 @@ public class Routes {
|
|||||||
(SELECT * FROM comments inner join posts ON comments.child = posts.id) com
|
(SELECT * FROM comments inner join posts ON comments.child = posts.id) com
|
||||||
inner join targets ON targets.id = com.parent
|
inner join targets ON targets.id = com.parent
|
||||||
)
|
)
|
||||||
SELECT targets.*, reactions.positive AS reaction FROM targets, reactions WHERE targets.id = reactions.post AND reactions.userid = (?);""");
|
SELECT * FROM targets LEFT JOIN (SELECT post, positive as reaction FROM reactions WHERE userid = (?)) ON post = id;""");
|
||||||
|
|
||||||
stmt.setObject(1, longitude);
|
stmt.setObject(1, longitude);
|
||||||
stmt.setObject(2, latitude);
|
stmt.setObject(2, latitude);
|
||||||
@@ -178,7 +178,7 @@ public class Routes {
|
|||||||
(SELECT * FROM comments inner join posts ON comments.child = posts.id) com
|
(SELECT * FROM comments inner join posts ON comments.child = posts.id) com
|
||||||
inner join targets ON targets.id = com.parent
|
inner join targets ON targets.id = com.parent
|
||||||
)
|
)
|
||||||
SELECT targets.*, reactions.positive AS reaction FROM targets, reactions WHERE targets.id = reactions.post AND reactions.userid = (?);""");
|
SELECT * FROM targets LEFT JOIN (SELECT post, positive as reaction FROM reactions WHERE userid = (?)) ON post = id;""");
|
||||||
|
|
||||||
stmt.setObject(1, id);
|
stmt.setObject(1, id);
|
||||||
stmt.setObject(2, User.getUserID());
|
stmt.setObject(2, User.getUserID());
|
||||||
|
|||||||
Reference in New Issue
Block a user