Android Question SQLite Like

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I have a SQLite DB that has a bunch of prefixes in it I want to see if the line I have matches one or more of the prefixes

Cannot figure out how to say something like this

B4X:
"Select * for PrefixFile where <line> LIKE PrefixData%"     ' where PrefixData is a Field in the PrefixFile that I want to LIKE on

Can the SQLite Column be on the right side of this statement?
'
 

aeric

Expert
Licensed User
Longtime User
You mean the matching should starts with value in PrefixData column?
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Data:
line PrefixData
B4X IDEs consists of B4A, B4i, B4J and B4R.B4X
B4A is an IDE to build Android apps.Android
Android Studio is very complicated.Android

SQL:
SELECT * FROM PrefixFile WHERE line LIKE PrefixData||'%'

Results:
linePrefixData
B4X IDEs consists of B4A, B4i, B4J and B4R.B4X
Android Studio is very complicated.Android
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Found the error in my code thanks to Aeric. I wasn't putting the quotes around the % sign
Had this
B4X:
$"select * for PrefixFile where ${line} LIKE PrefixData || %"$
 
Upvote 0
Top