MS Access 2007 查询未返回结果

发布于 2024-12-08 02:12:25 字数 544 浏览 0 评论 0原文

我使用以下查询来查找来自医学系的客户:

SELECT client.clientID, client.firstname, client.lastname, client.organization,
       client.department, client.email, events.Date, events.title,
       eventAttendance.eventID, eventAttendance.clientID,
       eventAttendance.attended
FROM client INNER JOIN 
     (events INNER JOIN eventAttendance ON events.id = eventAttendance.ID) 
     ON client.clientID = eventAttendance.clientID
WHERE client.organization like '%medicine'

在表中,可能的选项是“医学院”和“医学系”;但是,没有返回任何记录。我缺少什么?

谢谢。

I am using the following query to find client who are from the medicine department:

SELECT client.clientID, client.firstname, client.lastname, client.organization,
       client.department, client.email, events.Date, events.title,
       eventAttendance.eventID, eventAttendance.clientID,
       eventAttendance.attended
FROM client INNER JOIN 
     (events INNER JOIN eventAttendance ON events.id = eventAttendance.ID) 
     ON client.clientID = eventAttendance.clientID
WHERE client.organization like '%medicine'

In the table, the possibilities are "School of Medicine" and "Department of Medicine;" however, no records are returned. What am I missing?

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凶凌 2024-12-15 02:12:25

Access 中的通配符是 * 而不是 %

更改您的 sql,如下所示:

like '*medicine'

The wild card character in Access is a * not an %

change your sql like so:

like '*medicine'
没有你我更好 2024-12-15 02:12:25

我认为您可能并不总是有活动,因此您需要 LEFT JOIN:

SELECT client.clientID, client.firstname, client.lastname, client.organization,
       client.department, client.email, events.Date, events.title,
       eventAttendance.eventID, eventAttendance.clientID,
       eventAttendance.attended
FROM client LEFT JOIN 
     (events LEFT JOIN eventAttendance ON events.id = eventAttendance.ID) 
     ON client.clientID = eventAttendance.clientID
WHERE client.organization like '*medicine'

I think it is likely that you do not always have an event, so you need LEFT JOIN:

SELECT client.clientID, client.firstname, client.lastname, client.organization,
       client.department, client.email, events.Date, events.title,
       eventAttendance.eventID, eventAttendance.clientID,
       eventAttendance.attended
FROM client LEFT JOIN 
     (events LEFT JOIN eventAttendance ON events.id = eventAttendance.ID) 
     ON client.clientID = eventAttendance.clientID
WHERE client.organization like '*medicine'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文