I wants to pick the value from the "Order" column based on the latest date from the "Date" column. At the same time, I need to sum of "shipped" column and picked the grouped records that have the value in the "minimum" column equlas to 0
That is, I wants to get the result like the following based on the data above.
phone, order, shipped, minimum
111-2345, 100, 7, 0
I tried to use group by and having but I am getting syntax error
select, phone, order, sum(shipped), minimum from Test group by phone having date = max(date) and minimum = min(minimum)
I don't really know what to do anymore. Could someone please give me some advice.