WurzelGummidge
Technical User
Don't quite know how to make thisa simple but here goes..
I have 2 tables, an order table 'orders' and stock table 'stock'
(fields used are: stock.product,stock.status, orders.product, orders.customer,orders.order_date)
I am trying to UPDATE a flag ('status')in the stock table depending on orders of products (in STOCK table) with the following criteria:
IF the 'distinct count' of customers ordering a product over the last 3 months >=2
AND
qty of product sold over last 3 months >=3 THEN 'stock.status' = 'BTO'
this needs to work for every stock line in the stock table
Is this do-able ?
I have 2 tables, an order table 'orders' and stock table 'stock'
(fields used are: stock.product,stock.status, orders.product, orders.customer,orders.order_date)
I am trying to UPDATE a flag ('status')in the stock table depending on orders of products (in STOCK table) with the following criteria:
IF the 'distinct count' of customers ordering a product over the last 3 months >=2
AND
qty of product sold over last 3 months >=3 THEN 'stock.status' = 'BTO'
this needs to work for every stock line in the stock table
Is this do-able ?