织梦CMS - 轻松建站从此开始!

欧博ABG-会员注册-官网网址

欧博娱乐How to use placeholder '?' in LIKE ope

时间:2025-09-01 00:22来源: 作者:admin 点击: 5 次
I am working on a Java-based desktop application with MySQL as my back end. In this application there is section called 'Search' where four fields are

I am working on a Java-based desktop application with MySQL as my back end. In this application there is section called 'Search' where four fields are there - Key Skills (text field), Experience (combo box), City (combo box) and Notice Period (combo box). All the four field's value will be provided at run time. The key skills are comma separated values. I want a MySQL query using LIKE operator, with the help of which I don't have to provide comma separated values every time in the Key Skills text field. I just provide one value at run time and based on that value the query will fetch me the results using LIKE operator. My query is shown below

I have used placeholder '?' since my query is dynamic type. Is it possible to use placeholder in LIKE operator or does it only work with static type query?

String query = "SELECT F_Name, L_Name, Experience, Key_Skills, FROM Candidate cd JOIN Candidate2 cd2 ON(cd.Mobile = cd2.C_Mobile) WHERE Key_Skills LIKE '%?%'";

When I executed the above query it produced an error stating - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version server version for the right syntax to use near 'FROM Candidate cd JOIN Candidate2 cd2 ON(cd.Mobile = cd2.C_Mobile) WHERE Key_Skills' at line 1

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-09-03 07:09 最后登录:2025-09-03 07:09
栏目列表
推荐内容