I am trying to select rows from a table using a like expression.
i.e. SELECT * FROM TABLE WHERE MYCOLUMN LIKE ‘TR[7-9]’
Values in Table are TR1, TR2,TR3,… TR9
I don’t get syntax error but 0 rows returned.
I am trying to select rows from a table using a like expression.
i.e. SELECT * FROM TABLE WHERE MYCOLUMN LIKE ‘TR[7-9]’
Values in Table are TR1, TR2,TR3,… TR9
I don’t get syntax error but 0 rows returned.
Assuming HSQLDB:
WHERE "MYCOLUMN" BETWEEN 'TR7' AND 'TR9'
WHERE "MYCOLUMN" IN ('TR7', 'TR8', 'TR9')
WHERE CAST(SUBSTRING("MYCOLUMN",3) AS INTEGER) BETWEEN 7 AND 9
I don’t think HSQLDB 1.8 supports regular expressions directly in LIKE. So you square brackets would be read as characters, not as definition of a range.
.
Compare this thread:
.
If you use another database, please tell…