案例不适用于sql

时间:2016-10-25 06:52:27

标签: sql

select  employee_size_range_id 
from  tbl_employee_size_range 
where employee_range_values = '1 to 10'

以防:

SELECT employee_size_range_id,
       employee_range_values,
       CASE WHEN employee_range_values = '1 to 10' THEN 'employee_size_range_id'
FROM tbl_employee_size_range

4 个答案:

答案 0 :(得分:2)

 SELECT employee_size_range_id,employee_range_values, 
    CASE WHEN (RTRIM(LTRIM(employee_range_values)) = '1 to 10' ) 
    THEN 'employee_size_range_id' END 
 FROM tbl_employee_size_range.employee_range_values

答案 1 :(得分:1)

您在案件陈述中错过了END

答案 2 :(得分:0)

试试这个:

SELECT employee_size_range_id,
   employee_range_values,
   CASE WHEN employee_range_values = '1 to 10' THEN employee_size_range_id END AS X
FROM tbl_employee_size_range.employee_range_values

答案 3 :(得分:0)

SELECT employee_size_range_id,        employee_range_values,        如果employee_range_values =' 1到10'那么' employee_size_range_id'结束 FROM tbl_employee_size_range