SqlCeCommand 不支持子查询?
昨天我想创建一个 sql 查询(使用 system.data.sqlce ),它从移动设备上的 diff 表返回值。
我的场景如下: - sql表:Xtable(字段:name:是字符串,mat:是字符串,state:是int值); - XTable包含100条记录 我的sql语句是:
SELECT name, (SELECT count(*) from Xtable where state=0) as Marked, count(*) as Total
FROM XTable
GROUP BY name
结果:0行,因为我的第二个SELECT有错误。
如果我执行以下sql语句:
SELECT name, count(*) as Total FROM XTable GROUP BY name
result : > 0 rows.
Sqlcecommand不支持多选查询? 我该如何解决它?
yesterday I wanted to create a sql query ( using system.data.sqlce ) which return values from diff tables on mobile devices.
My scenario is as follows:
- sql table: Xtable (fields: name : is string, mat : is string, state : is int value);
- XTable contains 100 records
my sql statement is:
SELECT name, (SELECT count(*) from Xtable where state=0) as Marked, count(*) as Total
FROM XTable
GROUP BY name
result: 0 rows, because i have error with second SELECT.
IF I execute following sql statement:
SELECT name, count(*) as Total FROM XTable GROUP BY name
result : > 0 rows.
Sqlcecommand not support multiselect query?
how can I fix it ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SQL Compact 不支持这种类型的子查询。请参阅此 MSDN 论坛主题< /a> 进行确认。
SQL Compact does not support this type of subquery. See this MSDN Forum thread for confirmation.
如果您可以提供错误详细信息,那么很容易为您提供帮助。
count() 中没有参数
编辑
在您的编辑中,您在 count 中将 ***** 作为参数。原来是缺失的,对吗?
If you can give error details then it would be easy to help you.
No argument in count()
Edit
In your edit you have ***** as argument in count. It was missing originally, is it correct.