需要在我的第二张桌子中找到免费约会

时间:2019-12-16 22:12:30

标签: sql oracle join outer-join appointment

所以我在我的第一张桌子上放了Vets。

f"{1: 2d}"    #interpreted as sign therefore (accidentally) same effect  -> " 1"
f"{11: 2d}"   #interpreted as sign therefore a leading space is inserted -> " 11"
f"{1: >2d}"   #align is present, pad with ' '                            -> " 1"
f"{11: >2d}"  #align is present, pad with ' ' but number long enough     -> "11"

第二张表中有约会...

Vet 1/Branch 5  
Vet 2/Branch 5
Vet 3/Branch 6
Vet 4/Branch 6

在1月1日/第5分支查询时,是否有任何方法可以查看第二张表并返回“ Vet 2”,因为当时它们尚未“预订” /它们“可用”

Appointment1...1stJanuary...Vet1
Appointment2...2ndJanuary...Vet3
Appointment3...2ndJanuary...Vet4

如果您有我的主意,请尝试以下操作...我想这最后一行不起作用,因为'Vet 2'在右表中没有对应的'28 -JUL-02'。有什么可行的吗?

1 个答案:

答案 0 :(得分:0)

您要寻找NOT EXISTS吗?

SELECT S.FIRST_NAME, S.LAST_NAME
FROM STAFF S
WHERE NOT EXISTS (SELECT 1
                  FROM APPOINTMENT A
                  WHERE A.STAFF_NO = S.STAFF_NO AND
                        A.APP_DATE_TIME = DATE '2002-07-28'
                 ) AND
     S.BRANCH_NO='00005' AND
     S.JOB_DESC = 'Vet';