Order BY diffrence of two columns using DataMapper

32 Views Asked by At

I have a mysql table.
It contains 2 Column (startdate,enddate)
Both are of DateTime type Using sql

select * from ABC order by (enddate-startdate) DESC;

same thing i want in datamapper...but i m not able to do it Plz help

1

There are 1 best solutions below

0
Shubham Agrawal On BEST ANSWER

Thanks, i got one datamapper function to run sql query directly

repository(:default).adapter.select('select * from ABC order by (enddate-startdate) DESC')