I need to make an application for a used things auction company, so I need to create an interface where n clients can bid a minimum and a maximum bid for a X product and the system returns the winner, but making a rule for the customer to pay as much as possible. The business rule is a little different, because in this project, whoever gives the lowest value, but not his minimum (I do not understand why, but it will be so rs). For example, if the minimum value of a C client is $ 50.00 and the maximum value is $ 300.00 but in the round of calculation he can win with R $ 120.00 as the cheapest price, he would pay R $ 120.00 and not the R $ 50.00 which is their minimum. I hope I have been able to explain it to you. I want to know if you can do this with just a mysql query or with php together. And if so, how? Can anyone give me a light? (There is also the possibility of a tie)
The main query table would have:
- ID (pk)
- PRODUCT_ID (fk)
- CUSTOMER_ID (fk)
- MIN_PRICE (float)
- MAX_PRICE (float)
- WINNER (true or false)