I have a bid table:
id | product_id | price | quantity | user_id | created_at
I need to select all the bids for the selected user and show the bid position in comparison for the same product. This is an example of result I need (I need to order it by created_at).
Product 2 - 22$ - 100p - Position 3
Product 2 - 33$ - 100p - Position 1
Product 3 - 2$ - 100p - Position 7
Product 2 - 30$ - 100p - Position 2
Product 4 - 69$ - 100p - Position 4....
As you see results are not linear since the user will get bids for different products and random time. Is this possible to do with a single query?