SQLite Forum

[SELECT] Simple way to search for data that start with given pattern?
Login
This is not really answering the question about "something easier" to achieve yoru goal (because as Keith pointed out, there is no "something easier", though you can load the REGEX function itself and use that).

However, in the specific query you are trying to achieve, the most concise way to put it (barring loading the REGEX function), would be:  

```
SELECT COUNT(*) FROM MyTable WHERE SUBSTR(zip,1,2) IN ('01','04','54');
```

The problem with this approach (and the REGEX approach, unless there's an optimization I'm unaware of) is that they will be slower (assuming the "zip" column is indexed) than "... LIKE '01%' OR LIKE '04%' OR ..." because LIKE has an optimization whereby, if the searched-for entity is of the form "xxx%" (as opposed to '%xxx' or '%xx%') then it can use the Index, resulting in a much faster lookup.