简体   繁体   English

在Sql Command Crystal报表中使用Like'%“运算符

[英]Using the Like '%" operator in the Sql Command Crystal Reports

I have a query to pull out data based on parameters, but now I have a problem using the Like '%' operator in the query, so that when I select data based on this parameter only data with the letters prefixed to this operator can be pulled. 我有一个查询,可以根据参数提取数据,但是现在在查询中使用Like'%'运算符时遇到了问题,因此,当我基于此参数选择数据时,只能添加带有以该运算符为前缀的字母的数据拉。

Below is the query 下面是查询

select InventoryName,StockNumber,OBAL,RPO,XEFR,RDJ,RET,TSFR,ISS,PISS,ADJ,CBAL 
from Transactions
where InventoryName LIKE 'se%' and ReportingPeriod ='January 2005'
order by InventoryName,StockNumber

For example, with this I am able to pull data which has SE of January 2005. It works fine in SQL 2005 but now I want to use it in Crystal report as a parameter to help pull out data based on the InventoryName chosen and the month and year. 例如,通过此操作,我可以提取具有2005年1月SE的数据。它在SQL 2005中可以正常工作,但现在我想在Crystal Report中使用它作为参数,以帮助根据所选的InventoryName和月份提取数据。和一年。 I am new to Crystal Reports. 我是Crystal Reports的新手。

根据我的评论,您可以使用以下内容:

where   InventoryName LIKE @input + '%'

Use symbol '*' instead of '%'. 使用符号“ *”代替“%”。 I have encountered this problem also, sql requires '%' but CR requires '*', you can try simple example with CR designer, insert where clause in "RecordSelection". 我也遇到了这个问题,sql需要'%'但CR需要'*',您可以使用CR设计器尝试简单的示例,在“ RecordSelection”中插入where子句。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM