不能根据多个标准select唯一的logging

我有一个Excel工作表report格式如下:

 +----------+--------+-------------+ | file | column | columnIndex | +----------+--------+-------------+ | abc.xlsx | test | 14 | | def.xlsx | test | 55 | | abc.xlsx | xyz | 19 | | def.xlsx | xyz | 19 | +----------+--------+-------------+ 

我试图用ADODB来查询它,这样我就可以得到column和非空column的唯一对columncolumn columnIndex值。

我已经尝试了各种查询,但每个都给了我一个错误。

 SELECT [report$].column,[report$].columnIndex from [report$] group by [report$].column,[report$].columnIndex having [report$].column<>'' ORDER BY columnIndex 

给出这个错误:

 No value given for one or more required parameters. 

这个查询:

 select [report$].column,[report$].columnIndex from [report$] group by [report$].column,[report$].columnIndex where [report$].column<>'' order by columnIndex 

给出这个错误:

 Syntax error (missing operator) in query expression '[report$].columnIndex where [report$].column<>'''. 

这个查询:

 select distinct [report$].column,[report$].columnIndex from [report$] where [report$].column<>'' order by columnIndex 

给出这个错误:

 ORDER BY clause (columnIndex) conflicts with DISTINCT. 

我如何编写这个查询来获得唯一的值?

  • GROUP BY之前的地方

  • <>是等同于!=所以你应该传递值来比较你的[report$].column

  • No value given for one or more required parameters.可能是No value given for one or more required parameters.的原因No value given for one or more required parameters. 是拼错的字段名称。

例如 :

 WHERE [report$].column <> '' GROUP BY [report$].column,[report$].columnIndex ORDER BY [report$].columnIndex