I'm using a command that runs every second on node.js. It has the function of excluding any duplicate records for a given item, which is specified as in the example by AND t1.auction_id = 1335
.
DELETE FROM bid_account t1
WHERE t1.id < (Select max(t1.id) FROM bid_account t2 WHERE t1.bidding_price = t2.bidding_price) AND t1.auction_id = 1335;
I need it to delete a record that has an equal value in the bidding_price
column, and keep only one. But it is important that he does this search not across the table, but rather for a certain item as I reported at the beginning, through the auction_id
column.
I tried to run the above command, but it returns the following error:
#1064 - Você tem um erro de sintaxe no seu SQL próximo a 't1
WHERE t1.id < (Select max(t1.id) FROM bid_account t2 WHERE t1.bidding_price ' na linha 1
What's wrong with this query?
I use the MYSQL database, and the bid_account
table has the id
column as the index and primary.
If I use SELECT below, it returns the values in duplicity normally.
SELECT bidding_price, count(*) FROM bid_account WHERE 'auction_id' = 1335 GROUP BY bidding_price Having Count(*) > 1