lundi 1 janvier 2018

Laravel query outside database with 'between condition

I'm confused at Laravel's query DB. Here is my code:

collect(DB::connection('2ndDB')->select('select avgvalue, logtime from 2ndDB.mytable where logtime =?',array('14:38')));

It does work on and return the right value. However, once I change the SQL statement with 'between' condition, down here:

collect(DB::connection('2ndDB')->select('select avgvalue, logtime from 2ndDB.mytable between logtime =? and ?',array('14:38','15:00'))); 

It would get error. May I ask how to fix it?

Note: I am query the outside database that the 'mytable' is not declared in the mode/database/migration part. So, I use the (DB:connection()) in this way for query.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2q95Wxa
via IFTTT

Aucun commentaire:

Enregistrer un commentaire