mercredi 30 janvier 2019

different result laravel and cli postgresql

I have the following script/query in Laravel,

$q = "SELECT COUNT(*) AS lembar, SUM(r.worth) AS jumlah
FROM receipts r
JOIN customers c ON c.id=r.customer_id
JOIN customer_types ct ON ct.code=c.customer_type_code
WHERE r.print_date BETWEEN ? and ? and c.kelurahan=? AND ct.code IN(?)";


$group = ['Q', 'R', 'S'];
$g = join('/', $group);
$g_in = join("','", $group);


$x = new \stdClass;
$x->group = $g;
$x->result = \DB::select(\DB::raw($q), [
    $start_date,
    $end_date,
    $kel->kelurahan, // "KEBON PISANG"
    $g_in
]);

the query works well in PgAdmin, but in Laravel it's return 0, null. also when $kel->kelurahan change to something else it works on Laravel too.



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2SfxjlJ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire