我正在制定一个时间表,如果他们要在特定的一周工作,我会在那里添加工作人员。 我想显示一份在上周没有工作的员工名单。
我的表每周都会添加一个帖子,有人打算上班,所以我怎样才能收集那些不会在特定周工作的用户,而不会收到关于另一周的帖子。
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 ASCThis 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 ASCThis way you are selecting all the staff that is not in the list of staff that worked that week.
更多推荐
发布评论