开源之夏第三届火热来袭,高校学生参与赢万元奖金!>>>

表名:db_value
怎么编写sql,查出如下结果。(目前我使用的数据库是postgreSQL)
回答
Select 123456,654321 from (Select ts,code,value from table where ts=‘2022-08-18 00:00:00’ )a PIVOT (Max (a.values) FOR a.code in (123456,654321))bSelect 123456,654321 from (Select ts,code,value from table where ts=‘2022-08-18 00:00:00’ )a PIVOT (Max (a.values) FOR a.code in (123456,654321))b 手机盲打的,你试试
发表评论