I am working on a ecommerce project and want to select suppliers based on oldest date...Here is my DB design
Product
id(PK) name price added_date(DATE)
1 Samsung Note 180000 2016-09-30
2 Nokia Lumia 510 215000 2016-09-29
Supplier
id(PK) name registered_date(timestamp) stock
1 Easyshop 2016-09-30 12:50:12 10
2 T-mobile 2016-09-30 12:55:36 10
product_supplier
itemid(pk) supplierid(pk)
1 2
1 1
As you can see the item 1 as 2 suppliers. So, What i want to do: is to select items based on first added suppliers (like in FIFO method- first in - first out)
How can do such join query with timestamp as condition
?