本文介绍了Ms-Access:联接3个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
没有人有一个如何联接3个表的示例,我有以下语句,但缺少一个(语法错误运算符错误")
Does anyone have a example of how to join 3 tables, I have the following statement but I'm getting a missing a (syntax error "operator error")
da = New OleDbDataAdapter("SELECT [S].[Scheduled Vege], [V].[Description],
[DS].[Task], [DS].[Task Date], [DS].[Completed] FROM [Scheduled] AS S
INNER JOIN [Date Schedules] AS DS ON [S].[SchedID] = [DS].[SchedID]
INNER JOIN [Vegetables Descriptions] AS V ON [V].[Task] = [DS].[Task]
WHERE [DS].[TaskNumber] >= " & aFromDate & " AND [DS].[TaskNumber] <= " & aToDate & "
AND [DS].[Completed] = '" & aCompleted & "' ", conn)
谢谢
推荐答案
发现了问题,因为它是一个访问数据库,因此fisrt from语句和INNER JOIN需要放在方括号中,如下所示.
Found the problem, because it's an access database the fisrt from statement and INNER JOIN needs to be in brackets as shown below.
da = New OleDbDataAdapter("SELECT [S].[Scheduled Vege], [V].[Description],
[DS].[Task], [DS].[Task Date], [DS].[Completed] FROM ([Scheduled] AS S
INNER JOIN [Date Schedules] AS DS ON [S].[SchedID] = [DS].[SchedID])
INNER JOIN [Vegetables Descriptions] AS V ON [V].[Task] = [DS].[Task]
WHERE [DS].[TaskNumber] >= " & aFromDate & " AND [DS].[TaskNumber] <= " & aToDate & "
AND [DS].[Completed] = '" & aCompleted & "' ", conn)
这篇关于Ms-Access:联接3个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!