Mysql query in Datatables

Mysql query in Datatables

estudiosestudios Posts: 52Questions: 0Answers: 0
edited September 2013 in General
I would like to use datatables not with a complete table but with a simple query like
SELECT a as Name1, b as Name2, a+b as Diference FROM table WHERE a>1 AND b>2 ORDER BY b DESC.

Is there any simple way to do it?

Thanks

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You'd just make the SQL query using the `sql()` method of the Editor db class, like we've done before, with fetchAll to get the results, dumping them into an array which you then send to the client. The Editor class isn't smart enough to make this query itself - you need to use `sql()` to do it.

    Allan
This discussion has been closed.