Pass Wildcard to Report Query for one letter

I am trying to have a report where users can select from items with a single letter designation like A, B, C, etc. Is there a way to pass a wildcard to the report that can be used in the SQL query to get all of the letters instead of just one? I have tried using "LIKE" but when I use that, none of them work. I have only been able to get it to show data when using "=" and a letter.

Post exactly what you've tried for the SQL query using LIKE. It should be possible.

It is just
SELECT a bunch of things
FROM db
WHERE machine = ? AND etc (switching the = to LIKE for the attempt to do this)
and the ? is a parameter from a dropdown on the screen that is a string. So when I put in % or _ for the value to pass, nothing happens and the letters do not work either then. I have tried passed just A and 'A' and nothing happens.

What DB are you using? MySQL, Postgres, SQL server?

SQL Server

Try something like:

SELECT a bunch of things
FROM db
WHERE machine LIKE ? || '%'

Using MSSQL's double pipe concatenation operator. Or, if that doesn't work, LIKE CONCAT(?, '%') maybe.

Okay so the CONCAT seems to work while using it in the query. I thought I tried that, but know I tried to put that in the parameter box and that did not work. I will implement this outside of the test environment, but it worked here. Must have had some syntax wrong before. Thank you!!!

1 Like