开发者

Mysql : can select dupes ok, how do i select the other data at same time?

Firstly sorry if the title is confusing, difficult to explain in one line!

ok, so i'm making a script to alert me of any po开发者_JAVA技巧tential duplicate rows in my db.

SELECT events.date, events.ven_id, COUNT(*)
FROM events    
GROUP BY events.date, events.ven_id
HAVING COUNT(*) > 1 

this successfully finds duplicate row, however only returns the date and ven_id columns, id like to get an events.* into the select statement somehow but still only return duplicate rows.

is this possible?


SELECT events.date, events.ven_id, (select COUNT(*) events where date = ev.date and ven_id=ev.id) as eventcount
FROM events ev
GROUP BY events.date, events.ven_id 
where eventcount > 1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜