初始代码:
select e.* from employees as e where MOD(convert(int,'e.emp_no'), 2)= 1 and e.last_name != 'Mary' order by hire_date desc
跑不出来结果
【原因】:我在写代码的时候默认emp_no是字符,所以用了转化,但是在该题中不需要进行转化,下面代码可以运行成功。
修正代码:
select e.* from employees as e where MOD(e.emp_no,2)= 1 and e.last_name != 'Mary' order by hire_date desc