-
I'm trying to grab duplicates from a table (answered in a previous post..) but I'm having trouble getting another column out of the table:
(segments [segmentid, user_id, typeid])
SELECT b.user_id, count(b.user_id) from segments b
WHERE b.typeid = 100
group by b.user_id
having count(b.user_id) > 1
That basically grabs all the duplicate user_id's of ppl with a typeid of 100. But I want to grab the unique identifier[segmentid] so I can delete them from the table. But everytime I add that field, i get a 'not a group by function' error.. and I dont want to group the segmentid because it wont grab the duplicates.
SELECT b.segmentid, b.user_id, count(b.user_id) from segments b
WHERE b.typeid = 100
group by b.user_id
having count(b.user_id) > 1
Any help is appreciated. BTW: I LOVE THIS FORUM!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|