Crystal Report SQL表达式 [英] Crystal Report SQL Expression
本文介绍了Crystal Report SQL表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
请帮我为以下SQL语句编写正确的SQL表达式。
SELECT COUNT(tblStu_Attendace.Status)
FROM tblStu_Attendace
GROUP BY tblStu_Attendace.StudentID
WHERE tblStu_Attendace.Status = ' P'
先谢谢。
编辑(评论从答案中移出)
这个SQL表达式在Crystal中报告给出了错误:
SQL表达式中的错误:
无法从数据库中检索数据
语法不正确附近关键字select
解决方案
当我添加GROUP BY时实际发生此错误
EDIT
正确查询ld如下面SELECT tblStu_Attendace.StudentID ,COUNT(tblStu_Attendace.Status)
FROM tblStu_Attendace
GROUP BY tblStu_Attendace。 StudentID
WHERE tblStu_Attendace.Status = ' P '
检查查询中命令的顺序。
尝试
< pre lang =sql> SELECT COUNT(tblStu_Attendace.Status)
FROM tblStu_Attendace
WHERE tblStu_Attendace.Status = ' P'
GROUP BY tblStu_Attendace.StudentID
Hello,
Please help me to write the correct SQL Expression for the following SQL statement.
SELECT COUNT(tblStu_Attendace.Status)
FROM tblStu_Attendace
GROUP BY tblStu_Attendace.StudentID
WHERE tblStu_Attendace.Status='P'
Thanks in advance.
EDIT (Comments moved from Answer)
This SQL Expression in Crystal Reports gives me error:
Error in SQL Expression:
Failed to retrieve data from database
Incorrect syntax near the keyword select
解决方案
This error actually occurs when I add the GROUP BY
EDIT
Right query should be like belowSELECT tblStu_Attendace.StudentID, COUNT(tblStu_Attendace.Status) FROM tblStu_Attendace GROUP BY tblStu_Attendace.StudentID WHERE tblStu_Attendace.Status='P'
Check the order of commands in your query.
Try
SELECT COUNT(tblStu_Attendace.Status) FROM tblStu_Attendace WHERE tblStu_Attendace.Status='P' GROUP BY tblStu_Attendace.StudentID
这篇关于Crystal Report SQL表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文