Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to search column with func.group_concat? #118

Open
gotounix opened this issue Jun 12, 2019 · 1 comment
Open

How to search column with func.group_concat? #118

gotounix opened this issue Jun 12, 2019 · 1 comment

Comments

@gotounix
Copy link

gotounix commented Jun 12, 2019

I have a cloumn such as:

ColumnDT(func.group_concat(distinct(Role.name)), global_search=False, mData='roles'),

And search in DataTables not working for this column.
I found while I using having everything is okey.

SELECT * FROM users 
LEFT OUTER JOIN users_roles ON users.id = users_roles.user_id 
LEFT OUTER JOIN roles ON roles.id = users_roles.role_id 
having group_concat(DISTINCT roles.name) LIKE lower('%admin%')

But the real sql is using where.

Is there a way to solve it?

@tdamsma
Copy link
Collaborator

tdamsma commented Jul 3, 2019

No, that is not supported directly, search input is translated to a where clause. Probably you can work around this by doing a subquery first and then filtering (using where) in the outer query

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants