This site uses cookies and similar technologies.

If you don't change browser settings, you agree to it.

I understand
9 Posts
4 years ago


Working with tables of thousands of rows, I use the "Search Query" field which gives results (Name, Firstname) on Free tables. Ok.

Now, I'd like to have a Search field on top that would allow to find all the rows with taht name.

How do I modifiy the SQL Statement :

  SELECT Name, Firstname FROM #__customers ORDER BY 1, 2

to narrow the search to the input of the search box.

Something like 

  SELECT Name, Firstname FROM #__customers WHERE Name LIKE '%#sr_name#%' ORDER BY 1, 2

  sr_name being the name of the search field.

(but that does not work).

I need to show all on landing, and then only the searched names.

Get a VIP membership
9 Posts
4 years ago
Level 1

I found that this works

  SELECT Name, Firstname
  FROM #__customers
  WHERE [MATCH]Name||$uri->getValue('sr_name')[/MATCH]
  ORDER BY 1, 2

This is inspired from Examples 2 & 3 of

Is there somewhere a documentation that, beyond examples, gives an insight of the use of variables inside Search Queries?

For instance [MATCH] generates a " LIKE '%blabla%' " (the fields that contain blabla)

How can I generate a " LIKE 'blabla%' "?  (the fields that begin with blabla)

154 Posts
4 years ago
Level 2

Maybe you are looking for something like this ?

9 Posts
4 years ago
Level 3

Yes. Thank you for the link.

Get a Book for SEBLOD