php - query issue - query not pulling correctly -
so i'm having issue wrapping head around query should using feature need implement.
table_a orders_id customer_id customer_name 11121 78125 david garcia 11122 78126 joe smith 11123 78139 vincent lee 11124 78144 howard dorf table_b orders_id products_id backorder_date 11121 245-a null 11121 781-b null 11121 777-k null 11122 854-j 2014-06-29 11122 245-a 2014-07-05 11122 986-o 2014-07-01 11123 555-p 2014-06-28 11123 777-k 2014-06-28 11124 854-j 2014-07-11 11124 731-t 2014-06-30
select o.backorder_date table_b o join table_a q on q.orders_id = o.orders_id q.customers_id = $customer_id_var
now being pulled correctly, i'm running 1 issue. if order has multiple order dates , not same pull first 1 , stop. have no problem if first order date further future next one, run issues.
take instance last 2 rows in table_b. date query pick 2014-07-11. huge issue because 2014-06-30 come , go out notification. system believe 2014-07-11 earliest order date.
you mean want order backorder date?
"select o.backorder_date table_b o join table_a q on q.orders_id = o.orders_id q.customers_id = $customer_id_var order o.backorder_date asc"
Comments
Post a Comment