Trying to fetch data from table trades
but only out range of another table exchanges
which has two columns start_time
& close_time
.
TABLE exchanges
:
TABLE trades
:
I want to fetch only data of trades
which are out of range start_time
to close_time
from table exchanges
For example, trades table
has tradedate
07:00:00 then fetch because, exchange_id has 1... exchanges table start_time 9:15 and close_time 3:30 (range)
If tradedate time out of range (start_time
to close_time
) then fetch. How can I extract time only from dateTime "tradedate"? I am trying with query builder but...
` $user = optional(Auth::user())->id;
$value = DB::table('exchanges')
->leftJoin('trades', 'exchanges.id', '=', 'trades.exchange_id')
->where('trades.user_id', $user)
->whereRaw("? NOT BETWEEN start_time AND close_time", 'trades.tradedate')
->get();`
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire