我试图根据另一个列值将单列值拆分为多个列,我可以得到它,但我无法删除我得到的其他空值
表
create table tbl1
(id int, strtype varchar(50), strvalue varchar(20));
insert into tbl1 values
(1, 'name', 'a'),(1, 'value', 'a1'),(1, 'name', 'b'),(1, 'value', 'b1');
Run Code Online (Sandbox Code Playgroud)
期望的输出
NAME VALUE
a a1
b b1
Run Code Online (Sandbox Code Playgroud)
sql我试过
select
(case when strtype='name' then strvalue end) as name,
(case when strtype='value' then strvalue end) as value
from tbl1
Run Code Online (Sandbox Code Playgroud) 我对詹金斯比较陌生。我进入了一个场景,我需要读取控制台输出并找到一个特定的字符串并将其设置为环境变量。这个变量我会在一些下游工作中使用。
例如:我的詹金斯工作的控制台将包含类似
product_build_number: 123456
我已经研究过 FindText,日志解析器之类的插件,但它们不能帮助我将此值设置为环境变量
有人可以帮助找到这个数字并将其传递给下游工作吗?
**
更新答案:
**
def matcher = manager.getLogMatcher(".*product_build_number=(\\d+.*)")
if(matcher.matches()) {
pbn= matcher.group(1).substring(0)
manager.build.setDescription(pbn) // you can do anything with this here
}
Run Code Online (Sandbox Code Playgroud) 我需要得到单个表中两个字段总和的差异(如果这令人困惑,真的很抱歉),请继续阅读示例
id 类型 account_id stock_id 成交量价格值 ================================================== ======== 1 买 1 1 5 500 2500 2 买 1 4 30 200 6000 6 买 1 1 10 500 5000 7 卖出 1 1 3 500 1500 8 卖出 1 1 2 500 1000 9 卖出 1 4 20 120 2400
以上是我的示例数据,我希望我的 SQL 查询结果类似于,
account_id stock_id 交易量 totalAmount ============================================ 1 1 10 5000 1 4 10 3600
基本上在这里我试图获得唯一账户和股票组合的总买入价值并减去总卖出价值
这里的任何帮助将不胜感激。
提前致谢