The following query is showing same user for multiple times, how to make it unique?
$query = 'SELECT a.connection_id, a.connect_from, a.connect_to,
b.userid, b.thumb, c.name, d.user_id, d.field_id,
d.value as bday, e.creator, e.id as videoprofile,
DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(),d.value)), "%Y")+0 AS age
FROM `#__community_connection` AS a
LEFT JOIN `#__community_users` AS b
ON a.connect_to = b.userid
LEFT JOIN `#__users` AS c ON a.connect_to = c.id
LEFT JOIN `#__community_fields_values` AS d
ON a.connect_to = d.user_id
LEFT JOIN `#__community_videos` AS e ON a.connect_to = e.creator
WHERE a.connect_from = "' . $uid .'" AND d.field_id = "3"
ORDER BY DAYOFMONTH( bday ) ASC';
Add
DISTINCTafter yourSELECTto return only unique rows. So change the first line of your code to the following: