Excel中的SQL查询返回一个值使用两行或两列?
我正在运行从 Excel 到 SQL Server 的查询,该查询返回单个值。看起来好像这使用了 Excel 中的两个单元格。这是正确的吗?有办法防止这种情况吗?有没有办法预测Excel是否会使用额外的行或额外的列(我已经看到这两种情况都发生了)?
如果在 Excel 中,我使用“导入外部数据 -> 新数据库查询”,然后在 SQL Server 表上执行 count(),Excel 通常会将结果放在我开始时选择的单元格下方的单元格中执行新查询(不是添加额外的行,而是将值放在那里)。有时,它会在我选择的单元格的列之前插入一个额外的列,并将结果放入与我选择的单元格同一行的新列中。
有没有一种方法可以让 Excel 在与启动查询时选择的单元格相同的单元格中返回值?如果不是,有没有办法预测上述两种情况中哪一种会发生?
谢谢,
恩斯特
I'm running a query from excel to sql server that returns a single value. It seems as if this uses two cells in excel. Is this correct? Is there a way to prevent this? Is there a way to predict whether excel will use an extra row or an extra column (I've seen both happening)?
If, in excel, I use "import external data -> new database query", and then do a count() on an sql server table, excel usually puts the result in the cell underneath the cell which I had selected when starting to do the new query (not adding an extra row, but putting the value there). Sometimes, it will instead insert an extra column before the column of the cell I had selected and put the result in the new column in the same row as the cell I had selected.
Is there a way to have excel return the value in the same cell as the one selected when starting the query? If not, is there a way to predict which of the two scenarios above will happen?
Thanks,
Ernst
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于找到了答案:
取消选中保留列排序/过滤/布局
I finally found the answer:
uncheck preserve column sort/filter/layout