[英]string_agg ignore specific value in column
SELECT string_agg(col, ',') as cols
FROM (
SELECT
json_field_name || ' AS ' || csv_field_name as col
FROM pricing.sandbox_configurations
WHERE include is true
ORDER BY sequence_id
) a
Doing so gives me a result like这样做会给我这样的结果
product_cd AS product_cd,product_name AS product_name
However, what if I wanted to ignore the value name product_name and just want to return rest of the column values as strin glike that.但是,如果我想忽略值名称 product_name 并且只想将列值的 rest 作为字符串返回怎么办。
How would I achieve that?我将如何实现这一目标?
You can ignore product_name
by removing riws with this value in where clause.您可以通过在 where 子句中删除具有此值的 riws 来忽略
product_name
。
SELECT string_agg(col, ',') as cols
FROM (
SELECT
json_field_name || ' AS ' || csv_field_name as col
FROM pricing.sandbox_configurations
WHERE include is true
and <>'product_name'
ORDER BY sequence_id
) a
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.