catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.83k stars 1.15k forks source link

Issue Using Between #833

Closed AnumMuzahir closed 5 years ago

AnumMuzahir commented 5 years ago

Describe the bug Medoo broke while performing a between function in select query

Information

Version of Medoo: 1.6.1 Type of Database (MySQL, MSSQL, SQLite...):MySQL System (Liunx\Windows\Mac):Windows Detail Code My desired SQL Query : SELECT * FROM order o LEFT JOIN hotel h ON (o.hotel_id=h.id) WHERE o.date_time BETWEEN '2019-04-01' AND '2019-05-02 23:59:59'

My Medoo Implementation: $database->select("order(o)", ["[>]hotel(h)" => ["o.hotel_id" => "id"]], ["h.name","h.address","h.msisdn","o.order_id","o.platform","o.total_cost","o.stats","h.payment_cycle","h.payment_mode", "date"=>Medoo::raw("DATE(o.date_time)"), "o.delivered_time"], ["date"=>Medoo::raw("BETWEEN '2019-04-01' AND '2019-05-02 23:59:59'")]);

Expected output Hotel details along with the date orders.

Actual Output Empty Resultset

AnumMuzahir commented 5 years ago

Solution: $where = ["o.date_time[<>]"=>[$date1,$date2]];