Crystal Reports命令无法正常工作

时间:2017-06-25 06:39:12

标签: sql-server crystal-reports

我有一个水晶报告连接到一个带有参数的命令的表,此命令查询正在运行

SELECT 
    date1,  
    car_num, 
    ar_dromologiou, 
    Sum(kilomtres) As ksum, 
    sum(posostita_ltitra) as sumpos, 
    sum(shmaia) as sumkom, 
    sum(sinokomsim) AS x3
FROM 
    Table_1 
WHERE 
    date1 BETWEEN {?d1} AND {?d2} 
GROUP BY 
    date1, 
    car_num, 
    ar_dromologiou;

这不起作用

SELECT 
    date1,  
    car_num, 
    ar_dromologiou, 
    Sum(kilomtres) As ksum, 
    sum(posostita_ltitra) as sumpos, 
    sum(shmaia) as sumkom, 
    sum(sinokomsim) AS x3 
FROM
    Table_1 
WHERE 
    car_num LIKE {?c1} AND 
    date1 BETWEEN {?d1} AND {?d2} 
GROUP BY 
    date1, 
    car_num, 
    ar_dromologiou;

错误在哪里?

2 个答案:

答案 0 :(得分:0)

问题似乎出现在你比较car_num

的where子句中

如果您传递了参数{?c1}并且它不包含任何通配符字符,例如%_,那么您只能获得完全匹配。< / p>

使用适合您用例的通配符,例如

WHERE 
    car_num LIKE {?c1} + '%' AND 
    date1 BETWEEN {?d1} AND {?d2} 

这会将car_num开头的所有行与参数{?c1}的值匹配。

您可能需要查看LIKE运算符的文档。

答案 1 :(得分:0)

谢谢大家的答案,我发现非英文字符和水晶报告中的值需要一些额外的配置,但还没有找到,但是当我插入带有英文字符的记录和参数时输入英文字符,它显示了记录,所以关于字符编码。