This:
$stockCodes = \DB::connection('sage_accounts')
->table('sales_order_items')
->select('stock_code')
->from('sales_order_items')
->orderBy('stock_code')
->distinct()->get();
returns any stock code with an RDxxx-xx-H7-xx stock code format, but that's the incorrect format. The correct format is RDxxx-Hx-xx-xx. That query doesn’t return stock codes in that format. Take, for example sales order line item 11649, which has stock code RD0448-H7-09-28. It is not returned with the rest of the stock codes, and this:
$stockCodes = \DB::connection('sage_accounts')
->table('sales_order_items')
->select('stock_code')
->from('sales_order_items')
->where('id', 11649)
->orderBy('stock_code')
->distinct()->get();
Returns an empty data set. While this:
select distinct `stock_code` from `sales_order_items`
where `id` = 11649 order by `stock_code` asc
returns the correct data
Why will query builder not return items where the stock code is in format RDBxxxx-Hxx ?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2fysq4M
via IFTTT
Aucun commentaire:
Enregistrer un commentaire