本文介绍了如何找到一组数据并将其替换为不同的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是SQL和Crystal Reports的新手。我想找到一组数据并用另一组替换。

示例:



数据现在是CPT-NST或具有不同前缀/后缀的各种类似项目。我想将包含NST的任何内容更改为只读NST。我不想要任何前缀/后缀字母。该主题可能有50种不同的前缀/后缀和变体。在我的报告中,我想对包含NST的所有内容进行分组。由于NST使用了许多其他前缀/后缀,因此它使用不同的前缀/后缀对每个行项目进行分组。我希望任何包含NST的东西都可以组合在一起,无论前缀或后缀如何。

我希望这是有道理的。再一次,我在Crystal工作,但我的语法不是很正确。



顺便说一下,这些是我正在尝试更新的记录。 br $> b $ b

我尝试了什么:



这是我的开始:

如果(PART.COMMODITY_CODE)LIKE * NST *

那么(PART.COMMODITY_CODE)= NST

I'm new to both SQL and Crystal Reports. I want to find one set of data and replace with another.
Example:

Data is now CPT-NST or a variety of similar items with different prefixes/suffixes. I want to change anything that contains NST to read only NST. I don't want any prefix/suffix lettering. There are probably 50 different prefixes/suffixes and variations on that theme. In my report I want to group everything that contains NST. Since there are many other prefixes/suffixes being used with "NST", it's grouping each line item with a different prefix/suffix. I want anything that contains NST to be group together, regardless of prefix or suffix.
I hope that makes sense. Again, I'm working in Crystal but I'm not quite getting the syntax right.

By the way, these are records I'm trying to update.

What I have tried:

Here is what I started with:
If (PART.COMMODITY_CODE) LIKE *NST*
Then (PART.COMMODITY_CODE) = NST

推荐答案

... CASE WHEN PART.COMMODITY_CODE LIKE '%NST%' THEN 'NST' ELSE PART.COMMODITY_CODE END ...


这篇关于如何找到一组数据并将其替换为不同的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-08 12:11