请输入查询关键字:_______________ 查询
里面输入学号 或者 姓名 或者 班级 都能查到 的 数据库查询语句
------解决方案--------------------
select * from AAA where (学号 like '%输入值%') or (姓名 like '%输入值%') or (班级 like '%输入值%') ;
------解决方案--------------------
补充下 表 :student
列名: stuID ,stuName,class
输入的字:String name=this.jtf1.getText().trim();
String sql = "select * from student where (stuID = " + name + " ) or ( stuName like '% " +
name +"%') or (class like '%" + name "%') " ;
------解决方案--------------------
- SQL code
if not object_id('tempdb..#Student') is nullbegindrop table #Studentendcreate table #Student(stu_id nvarchar(36),stu_name nvarchar(36),stu_class nvarchar(36))insert into #Studentselect '1','a','b' union allselect '2','b','b' union allselect '3','c','b' union allselect '4','d','c' union allselect '5','e','d' select * from #Student where stu_id='c' or stu_name='c' or stu_class='c'/*3 c b4 d c*/
------解决方案--------------------
如果是模糊查询,就用各个字段 like '%输入的信息%',然后or各个条件就可以了
如果是精确查询,就用各个字段 = '输入信息',然后or各个条件
for example
- SQL code
--模糊查询select * from student where stuID like '%' || your_text || '%' or stuName like '%' || your_text || '%' or [class] like '%' || your_text || '%'--精确查询select * from student where stuID = your_text or stuName = your_text or [class] = your_text