Database Class: GROUP BY
Database Class: GROUP BY

I'm currently rewriting everything in my project from medoo to Datatables. The only query that is left is the following:
$medoo->select('form_autocomplete', ['type', 'text' => Medoo::raw('GROUP_CONCAT(text)')], ['GROUP' => 'type']);
What I have so far is:
$db->query('select', 'form_autocomplete')->get(['type', 'GROUP_CONCAT(text) as text'])->exec()->fetchAll();
I already checked the documentation and the source code but there is unfortunately no ->group_by('type')
. Does anyone have an idea how I could do that. I know that you can extend classes in PHP but I don't think that this is all that needs to be done there.
This question has an accepted answers - jump to answer
Answers
You could use the
sql
method which just takes a raw query string and executes it without trying to do anything clever (building the SQL).Its not ideal, but it does allow SQL methods to be executed for which the libraries don't have an abstraction (such as GROUP BY).
Allan
If I had known about this method I would have used it right away. This solution is more then enough.
Thanks a lot.