小编Mar*_*vić的帖子

如何乘以列并添加结果?

假设一个表有两列名为“x”和“y”的列填充了数字;例如,x 包含值 (1, 2, 3),而 y 包含 (5, 8, 20)。

如何计算列的乘积之和,即 (1 × 5) + (2 × 8) + (3 × 20) = 81?

sql sqlite

6
推荐指数
1
解决办法
4979
查看次数

如何将没有时区的时间转换为没有时区的时间戳?

我需要在PSQL中的一个表中转换几列,我真的不想放弃表来解决这个问题(这是我的最后一招).有没有办法做到这一点,因为当我写:

    ALTER TABLE table ALTER TABLE column type TIMESTAMP without time zone using column::TIMESTAMP without time zone; 
Run Code Online (Sandbox Code Playgroud)

它不起作用,说:

    ERROR:cannot cast type time without time zone to timestamp without time zone.
Run Code Online (Sandbox Code Playgroud)

PS如果可能,我想避免删除列,因为我已经使用了这些列的索引.

sql postgresql

4
推荐指数
1
解决办法
3769
查看次数

标签 统计

sql ×2

postgresql ×1

sqlite ×1