php - Complex SQL Query Returning Duplicate but varing Values even with key word DISTINCT -
Based on the following query I just need to return two sets of data, but I get four instead < / p>
SELECT DISTINCT *, CASE WHEN likes.face_id = persona.face_id then liked '1' ELSE '0' END, case when dislikes.face_id = persona.face_id then '1' or '0 'End dislike, case when comments .face_id = persona.face_id then' 1 'ELSE' 0 'END tags the person, likes, dislikes, comments commented, tag tags tagged on the tag. Phone_id = 'fa' ou persona.face_id = tag. Face_id are the following tables I
Inquired from the tagged table:
Phone_Image Face_id such as discounted discount comment comment FA GA 1 1 1 FA SA 1 0 Personality table:
The name of the face_id is GA frank 34 SA mark 24 Preferences table:
face_id phone_ id GA FA SA FA Dislikes table:
Face_id f Note_FAQ Comment table:
face_id phone_id comment GA FA good I get four values (four sets of data) from the above query instead of two (two set of data) values
The data given above is the result of the above query "1", " dislikeCount ":" 1 "," commentCount ":" {0} "data": "{" "face_id": "GA", "likeCount": "1", "dislikeCount": "php
{"face_id": "SA", "lik "0", "comment": "0", "commentCount": "0", "name": "frank", "age": "24", "likes": "0", "comment" : "1", "dislikeCount": "1", "commentCount": "0", "dislikes": "0"},
{"face_id": "GA", "likeCount": "1", "dislikeCount" "1", "name": "34", "likes": "0", "commented,": "1", "dislikes": "0", "0" , "0", "commented", "frank", "0", "0", "1"},
{"face_id": "SA", "likeCount": "1", "dislikeCount" "0", "dislikes": "0"}}} P>
A more general approach
SELECT *, CASE WHEN, like .face_id = persona.face_id THEN '1 Likes' ELSE '0' END, Matters When in dislike.face_id = personality.face_id then dislikes the '1' or '0' end, the comments where comments.face_id = tag.face_id then added '1' or '0' comment from the comment commentary person .face_id = tag .face_id LEFT JOIN likes .face_id = persona.face_id and likes. Phone_id = 'FA' Skip Dislikes on Dislikes .face_id = tag.face_id and Dislikes. Phone_id = Join the comment on 'FA' comment Face_id = tag.face_id and comments.phone_id = 'fa' where was tagged. Phone_id = 'FA' But there is a problem, all face-in-the-eyes come out as
Comments
Post a Comment