SELECT * FROM table a WHERE ((SELECT COUNT(*) FROM table WHERE openid = a.openid) > 1) ORDER BY openid DESC