sqldebuggingms-accessms-access-2010ansi-sql-92

Search pattern % doesnt work in access


In the table trans I have two such values t_bar and t_pro, and I want to find such values in the table. that start with "t_" So I`m using such query:

select trim(col)
from trans
where trim(col) like "t_%";

No rows are returned. However such query will return desired 2 rows:

select trim(col)
from trans
where trim(col) like "t_***";

What is wrong here? I need to use %, because the real situation more difficult.


Solution

  • To match any number of characters that start with t_ you should use,

    select trim(col)
    from trans
    where trim(col) like "t_*"