Using instr in Where Clause of query

I want to be able to use the instr in a queries where clause.

I want to return all the rows that have ‘550’ within the text field “sn” (note sn is a 10 character textfield)

I don’t care where the 550 falls within the field.

My code is …
select id,item,type,sn from data where item=‘Car’ and instr(sn,‘550’,0)

but its not returning anything when I know i have data

Thanks
Jim

Try:

select id,item,type,sn from data where item='Car' and sn LIKE '%550%'

Kem

THANKS!! So simple!

Spent 2 hrs trying to get the instr to work…

Jim

SELECT id, item, type, sn from data WHERE item=‘Car’ and instr(sn,‘550’)<>0

just to add.

in case of searching alpha characters… be sure to take case into consideration by using UPPER to avoid case sensitive restraints.

i never ever use INSTR in sqlite before… learn something new today

[quote=148819:@Rich Hatfield]just to add.

in case of searching alpha characters… be sure to take case into consideration by using UPPER to avoid case sensitive restraints.[/quote]

or LIKE with no wildcards