I need to search my database which contains user information table. I know to get the result by searching with the query like the following
String query;
StringBuilder sb=new StringBuilder(1024);
sb.append("select * from userinfo where uname=").append(key);
query=sb.toString();
But what I need to do is.
abcabcabc, aba, gjabc ,abcxyz,hjjabcxyzabc, gjabc, abcxyz, hjjabcxyzabc in common.How can I achieve this?
If you are using pure SQL you should use like surrounded with "%". Your query will then return all rows where uname contains "abc". Your query needs to look like this:
select * from userinfo where uname like '%key%'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With