我有一些SELECT
查询,其中包含使用参数的WHERE
子句中的子查询。 OLEDB似乎希望首先列出子查询中的参数。有没有一种方法可以确定列出参数的顺序?
例如
SELECT txtUserName FROM tblUsers AS U WHERE txtType = ? AND " +
" lngUserID IN ( SELECT lngUserID FROM tblUserGroups AS UG INNER JOIN tblGroups AS G ON UG.lngGroupID = G.lngGroupID WHERE G.txtName = ? ) AND " +
" lngUserID IN ( SELECT lngUserID FROM tblUserGroups AS UG INNER JOIN tblGroups AS G ON UG.lngGroupID = G.lngGroupID WHERE G.txtName IN ( SELECT txtName FROM tblGroups G WHERE txtComment = ? ) )
为了使它起作用,我不得不在其他两个参数之后添加txtType参数。