gpt4 book ai didi

MySQL:选择上次修改时具有一个属性但过去没有其他属性的项目

转载 作者:行者123 更新时间:2023-11-29 11:06:40 24 4
gpt4 key购买 nike

所以我有一个按以下方式构造的表格标题

emp_no  title               from_date   to_date
109006 Senior Engineer 1998-02-10 9999-01-01
109008 Senior Engineer 1998-09-23 9999-01-01
109009 Senior Engineer 1998-10-21 9999-01-01
109010 Assistant Engineer 1986-05-23 1994-05-23
109010 Senior Engineer 2002-05-23 9999-01-01
109012 Senior Engineer 1995-08-31 2000-04-30
109014 Senior Engineer 1986-09-04 9999-01-01
109015 Senior Engineer 1996-10-15 9999-01-01
109017 Assistant Engineer 1997-06-22 9999-01-01
109018 Assistant Engineer 1988-08-15 1996-08-15

我想选高级工程师,而不是助理工程师。例如,不应显示带有 emp_no 109010 的内容。

我试过了

select * from titles where title='Senior Engineer' AND title NOT IN (select emp_no from titles where title='Assistant Engineer')

但是它不起作用。

最佳答案

你很接近:

select * from titles 
where title='Senior Engineer' and emp_no
NOT IN (select emp_no from titles where title='Assistant Engineer')

关于MySQL:选择上次修改时具有一个属性但过去没有其他属性的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41288494/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com