在SQL中替换多个字符?

时间:2017-03-13 09:01:35

标签: sql

我如何显示* 具有以下条件:

  1. 学号必须不包含以下字符串:231
  2. 姓氏必须以字母S
  3. 开头
  4. 课程编号不得为DEV1或DEV2

3 个答案:

答案 0 :(得分:1)

你可以试试这个:

 Select * From [TableName] 
 Where Studend_Number not like '%231%' and 
       Student_Surname like '%S' and 
       Course_Number not in ('DEV1','DEV2')

答案 1 :(得分:1)

Use 3 conditions in WHERE Clauses :

SELECT *
FROM Your_table 
WHERE Studentnumber NOT LIKE '%231%' AND surname LIKE 'S%' AND coursenumber 
NOT IN ('DEV1', 'DEV2')

答案 2 :(得分:0)

SELECT * 
FROM tablename 
WHERE student_number <> 231 
   AND surname LIKE 's%' 
   AND coursenumber NOT IN ('DEV1','DEV2')