Skip to content
Advertisement

Create a query to select data from MYSQL WHERE min(i_status) = 4

I Have two MY SQL tables OrderTable

and itemTable

Im recive all orde whit query1 -ResultTable1 – it ok

ResultTable1

but I need to receive all orders, goods with which have a minimum status of 4, and the sum of all goods from this order, not only goods with ID = 4 My query should look like this, but it does not give a result.

I want to see next result:

if I change the request where to WHERE i_status = 4 without MIN I will get almost what I need, but the order amount will be less, since not all goods are counted.

Advertisement

Answer

Thank you for taking the time to resolve my issue. But I need to comply with two conditions at the same time WHERE min(i_status) = 4 AND sum(i_cost*i_pcs) whit all item status Perhaps the only answer is array processing without WHERE

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement