Search issue when using mysql group_concat()

Search issue when using mysql group_concat()

rahulbohrarahulbohra Posts: 6Questions: 3Answers: 0

Hi folks,

Table A :
- id
- firstname
- lastname
- dob

Now, in MYSQL is use group_concat('firstname', ' ', 'lastname') as Name.

Here, in frontend i am able to see firstname and lastname together, but while searching it will only search firstname but NOT lastname, infact if I search only lastname it will NOT search.

In my column definition I have to pass firstname like

['data' => 'Name', 'name' => 'firstname'],

I can't contact firstname and lastname together.

I have LAST option (which i want to avoid) is to make VIEWS.

Please help.

Thanks,
Rahul Bohra

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @rahulbohra ,

    Are you using Editor? If not, do you have serverSide enabled? It would help if you could link to your page or post your table initialisation code.

    Cheers,

    Colin

  • rahulbohrarahulbohra Posts: 6Questions: 3Answers: 0
    edited March 2019

    Hi @collin ,

    I got the solution by myself. Thanks for your reply.

    Solution

    // allows use of pipes as CONCAT function in SQL
    SET SESSION sql_mode = 'PIPES_AS_CONCAT';

    and in Column definition

    ['data' => 'Name', 'name' => "(firstname ||' '|| lastname)"]

    Answer to your question I am not using EDITOR and my server side is enable

This discussion has been closed.