I'm working on a social project and there are some tables which will have similar records which i'd like to group them into one. but with my query in brings all the records instead of grouping them into one.
SELECT
users_pics.email
, pic = MIN(pic)
, count(pic) AS total
,fname
,lname
,profile_pix
,RTRIM(wardrobe) as wardrobe
,gender
, resp_email
FROM
users_pics
INNER JOIN
profile
ON
users_pics.email = profile.email, dbo.viva_friends
WHERE
users_pics.stat = 'new'
AND
resp_email = MMColParam2
OR
req_email= MMColParam
AND
Status = 'Yes '
GROUP BY
users_pics.email
,fname,lname
,profile_pix
,wardrobe
,gender
,req_email
,resp_email
ORDER BY
MAX(users_pics.u_pic_id) DESC
please is there a way out. when i hit on the run button i get this.