Article category:Java programming
I searched for ibatis's use of like on the Internet. I believe the xdjm in this article should also know how to solve it. I will not repeat it here. I just want to explain it again:
Leave '% $ xxx $ %' blank. The solution is as follows:
SQL code
- Select*
- FromUser
- WhereUsername like '%' | # username # | '%'
Select * from user where username like '%' | # username # | '%'
In fact, the above statement is correctOracleFor different data string connectors. MySQL and sqlserver are listed as follows:
MySQL:
SQL code
- Select*
- FromUser
- WhereUsername like Concat ('%', # username #, '% ')
Select * from user where username like Concat ('%', # username #, '% ')
Turn: http://lawuu.iteye.com/blog/230791
Sqlserver:
SQL code
- Select*
- FromUser
- WhereUsername like '%' + # username # + '%'
Select * from user where username like '%' + # username # + '%'
Bytes -----------------------------------------------------------------------------------------------------------------------------
Some databases I have used are listed as follows:
| Oracle |
Sqlserver |
MySQL |
DB2 |
| | Or Concat () |
+ |
Concat () |
| Or Concat () |
More string connectors for other databases: Google!