I am developing an iphone app which has its backend in Sqlite. I want to search a pattern from the db table. I used the following query for that
SELECT roman,walpha FROM gurbani where walpha LIKE 'rm rs% p%'
My requirement is the results should contain first word 'rm', second word starting with 'rs' and the third word must start with 'p'.
The following is a screen shot of the result of my sql query
Here in my results the lines in walpha 3,6 and 7 are wrong, as I want the third word to be starting with the letter'p'. This is because of the use of 'rs%' in the sql query. So I tried another query as follows:
SELECT roman,walpha FROM gurbani where walpha LIKE 'rm rs p%'
But this results only the 4th line in the above screenshot. I am new in Sql. Is there any other method for search my pattern ?
select roman,walpha from gurbani where walpha like 'rm%rs%p%'
try this it should definitely work for your requirement.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.