Home>

I am writing a game project. The following question arose. There is a bag with things. Things fall into the bag according to their ID. But if two clothes are identical, then their IDs are also the same. And when a person wants to sell one item, the second is sold automatically without charging the player money. How to delete only the first occurrence by condition in SQL? And leave the second?

ORDER BY `id` DESC LIMIT 1

Tried this, but you quit). I would be grateful for your help.

The table must have a field that is unique to the record (primary key). Create, Execute delete exactly on the value of the primary key.

Akina2021-11-17 12:25:19

Thanks. Did.

Ксения Анефина2021-11-17 12:28:54