查询语法错误 [英] Query Syntax error
本文介绍了查询语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助我纠正以下查询:
Please help me correct the following query:
SQL = "insert into tblContract (Empid, Start1, Finish1, Store1, " & _
"Start2, Finish2, Store2 ) " & _
"values ('" & Me.txtEmpNo.Value & _
"',select max(testid) FROM tbltesting,'" & _
Me.txtContSunStart1.Value & "', '" & _
Me.txtContSunFinish1.Value & "','" & _
Me.txtContSunStore1.Value & "','" & _
Me.txtContSunStart2.Value & "', '" & _
Me.txtContSunFinish2.Value & "','" & _
Me.txtContSunStore2.Value & "')"
问题在这里:
select max(testid) FROM tbltesting
还有其他选择吗?
推荐答案
子查询应放在括号中:(select max(testid) FROM tbltesting)
Sub-queries should be enclosed in parentheses: (select max(testid) FROM tbltesting)
请注意,您的SQL引擎可能不支持INSERT
语句中的子查询,因此您应该使用INSERT...SELECT
查询来插入.
Note that your SQL engine will probably not support sub-queries in the INSERT
statement, so you should insert using a INSERT...SELECT
query instead.
这篇关于查询语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文