62,629
社区成员
 发帖
 发帖 与我相关
 与我相关 我的任务
 我的任务 分享
 分享
--模糊查询
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
if not object_id('tempdb..#Student') is null
begin
drop table #Student
end
create table #Student(stu_id nvarchar(36),stu_name nvarchar(36),stu_class nvarchar(36))
insert into #Student
select '1','a','b' union all
select '2','b','b' union all
select '3','c','b' union all
select '4','d','c' union all
select '5','e','d' 
select * from #Student where stu_id='c' or stu_name='c' or stu_class='c'
/*
3	c	b
4	d	c
*/