-2

I have a website like ebay with bids, I want to make a notifications mail for users who got outbidded

For example

  • user 1 has a bid 11$
  • user 2 has a bid 10$

I have a table for bids:

 id  auction    bidder      bid  bidwhen         quantity  auto_bid  
 --  -------   ------  -------  --------------  --------  ----------
 1   150028       2  10.0000  20130719121024         0           0
 2   150028       1  11.0000  20130809122605         0           0
 3   150028       3  12.0000  20130809122605         0           0

and another table where I insert a winners like winner=3 with =12

 id  auction  seller  winner     bid  closingdate        fee  quantity  
--  -------  ------  ------  ------  --------------  ------  ----------
 1   150028  1       3           12  20130809122658       1           1

If in our case id=3 is winner I need notificate id=2 that he is outbid and lost

I start with selecting winner and join bidders table but I can't figure out how to continue.

At the end I need get last ID before Winners ID in our case bidder 1 cuz he bid last before winner

4

2 に答える 2