选择字符串不存在的行(select row where string dose not exist)

编程入门 行业动态 更新时间:2024-10-27 00:36:24
选择字符串不存在的行(select row where string dose not exist)

我正在制定一个时间表,如果他们要在特定的一周工作,我会在那里添加工作人员。 我想显示一份在上周没有工作的员工名单。

我的表每周都会添加一个帖子,有人打算上班,所以我怎样才能收集那些不会在特定周工作的用户,而不会收到关于另一周的帖子。

SELECT tblStaff.strName as staffName, tblWorktable.strName as workName FROM tblStaff, tblWorktable WHERE tblWorktable.intWeek <> 9 ORDER BY tblStaff.strName ASC

这会收集那些不会在9周工作的用户,但当然,它也会收集所有正在工作的用户,比方说10或32周,我不想要任何其他信息,而不是关于一周九号。

I'm working on a timetable, where I add the staff if they are going to work in a specific week. I want to show a list of staff that dose not work in the said week.

My table add a post for every week that someone is going to work, so how can I collect only the users that dose not going to work a specific week, without getting the posts that regards another week.

SELECT tblStaff.strName as staffName, tblWorktable.strName as workName FROM tblStaff, tblWorktable WHERE tblWorktable.intWeek <> 9 ORDER BY tblStaff.strName ASC

This collects the users that aren't going to work week nr 9, but of course, it does also collect all the users that are going to work, lets say week nr 10 or 32, and I do not want any other information than about week nr 9.

最满意答案

我想你可以尝试这样的查询:

SELECT staffName FROM Worktable WHERE staffName NOT IN (SELECT DISTINCT staffName FROM Worktable WHERE intWeek = '$week') ORDER BY staffName ASC

通过这种方式,您可以选择不在当周工作人员列表中的所有员工。

I think you can try with a query like this:

SELECT staffName FROM Worktable WHERE staffName NOT IN (SELECT DISTINCT staffName FROM Worktable WHERE intWeek = '$week') ORDER BY staffName ASC

This way you are selecting all the staff that is not in the list of staff that worked that week.

更多推荐

本文发布于:2023-08-05 08:07:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1428769.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不存在   字符串   select   row   dose

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!