I have a table called Player in my database, it looks like this
id placex placey wealth strenght goalx goaly
---------------------------------------------------------------
1 500 20 3335 2500 500 440
2 500 20 777 2000 20 500
3 20 500 1000 2000 500 20
4 500 440 1000 2000 20 20
I need a query that would display id and wealth on a condition that players a located in the same location so there should be a duplicates of placex, placey for different players
In this table we would have player with id 1 and player with id 2 in the same place, I wrote this
SELECT
id, placex, placey, wealth
FROM
Player
WHERE
placex IN (SELECT placex FROM Player HAVING COUNT(id) > 1);
and I get this as output
+----+--------+--------+--------+
| id | placex | placey | wealth |
+----+--------+--------+--------+
| 1 | 500 | 20 | 3335 |
| 2 | 500 | 20 | 777 |
| 4 | 500 | 440 | 1000 |
+----+--------+--------+--------+
I need to eliminate player with id 4, so how do i modify my query to include also dups of placey
I expect to get this
| id | placex | placey | wealth |
1 500 20 3335
2 500 20 777