且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在一个查询中使用IN和LIKE这两个SQL Server命令在一个查询字符串中

更新时间:2023-02-22 12:48:26

喜欢,请参阅此-

http://msdn.microsoft.com/en-us/library/ms179859.aspx [ ^ ]

对于IN来说,这是
http://msdn.microsoft.com/en-us/library/ms177682.aspx [ ^ ]
For LIKE see this -

http://msdn.microsoft.com/en-us/library/ms179859.aspx[^]

and for IN see this -
http://msdn.microsoft.com/en-us/library/ms177682.aspx[^]


尝试这个
select * from CandidateDetails where FirstName in (''ra'') or LastName like ''%ul%''


检查 this [
Check this[^] thread. I feel you are looking for same thing.

Update: I assume that the there are column names after the in clause.

select * 
from CandidateDetails 
where (firstname like (% ''"+textBox.Text+"''%)) OR
(lastname like (% ''"+textBox.Text+"''%)) OR
(middlename like (% ''"+textBox.Text+"''%)))



这可能会有所帮助.



This may help.