本文介绍了MySQL - 查询所有用户没有约会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有两个表:用户和约会。我如何查询数据库以找到如下所示的内容:
If I have two tables: Users and Appointments. How would I query the db to find something like the following:
SELECT * FROM users WHERE (none of: appointments.user = user.id)
我假设我需要一些类型的约会表,确定从哪里开始。
I am assuming I would need some type of join with the appointments table, just not sure where to start.
推荐答案
SELECT * FROM users
LEFT JOIN Appointments ON Users.UserID=Appointments.UserID
WHERE Appointments.UserID is null
这篇关于MySQL - 查询所有用户没有约会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!