这样cnname会有重复的
时间: 2024-01-12 15:04:12 浏览: 154
如果 t1.CNNAME 可能会有重复的话,可以使用 DISTINCT 关键字来去重,如下所示:
```
SELECT DISTINCT t1.CNNAME, t2.CNNAME AS PCNNAME
FROM bo_act_dict_kv_item t1
INNER JOIN bo_act_dict_kv_item t2 ON t1.EXTTEXT1 = t2.ITEMNO
WHERE t1.DICTKEY = 'PLM_INITIALBOM_STATUS' AND t1.EXTTEXT1 != '' AND t2.CNNAME IS NOT NULL;
```
这样,返回的结果中 t1.CNNAME 不会有重复值。
相关问题
hive如何获取cnname
Hive 可以通过在表的元数据中添加一个 cnname 字段来获取中文名称。可以使用 ALTER TABLE 命令来添加 cnname 字段,例如:ALTER TABLE table_name ADD COLUMNS (cnname STRING); 然后可以使用 DESCRIBE 命令来查看表的元数据信息,包括 cnname 字段。例如:DESCRIBE table_name;
hive如何获取{ "CustomCell": [{ "enName": "Name", "cnName": "企业名称" }, { "enName": "OperName", "cnName": "法定代表人" }, { "enName": "StartDate", "cnName": "成立日期" }, { "enName": "Address", "cnName": "企业注册地址" }, { "enName": "PhoneNumber", "cnName": "电话" }, { "enName": "MoreTelList", "cnName": "更多电话" }, { "enName": "InsuredCount", "cnName": "参保人数" }, { "enName": "Scope", "cnName": "经营范围" }] }里的cnname
可以使用Hive中的json_tuple函数来获取{ "CustomCell": [{ "enName": "Name", "cnName": "企业名称" }, { "enName": "OperName", "cnName": "法定代表人" }, { "enName": "StartDate", "cnName": "成立日期" }, { "enName": "Address", "cnName": "企业注册地址" }, { "enName": "PhoneNumber", "cnName": "电话" }, { "enName": "MoreTelList", "cnName": "更多电话" }, { "enName": "InsuredCount", "cnName": "参保人数" }, { "enName": "Scope", "cnName": "经营范围" }] }中的cnname。具体的语法为:json_tuple(json_string, key1, key2, ...),其中json_string为json格式的字符串,key1、key2等为需要获取的键名。因此,可以使用以下语句来获取cnname:
SELECT json_tuple('{"CustomCell":[{"enName":"Name","cnName":"企业名称"},{"enName":"OperName","cnName":"法定代表人"},{"enName":"StartDate","cnName":"成立日期"},{"enName":"Address","cnName":"企业注册地址"},{"enName":"PhoneNumber","cnName":"电话"},{"enName":"MoreTelList","cnName":"更多电话"},{"enName":"InsuredCount","cnName":"参保人数"},{"enName":"Scope","cnName":"经营范围"}]}', 'CustomCell', '', 'cnName');
阅读全文