1. 日期格式转化(参考

select beg_time, end_time, extract(epoch from to_timestamp(end_time,'yyyy-mm-dd-HH24-MI-SS-US'))-extract(epoch from to_timestamp(beg_time,'yyyy-mm-dd-HH24-MI-SS-US')) from cdb_all_iu_data where beg_time > '2017-09-21' 

postgreSql 常用查询总结

注:beg_time, end_time以TEXT形式存储,求时间差时转化为时间戳再相减得到结果(s)

2. select * from (中间结果) t

select count(*) from (
select chkid, count(*) from abc_table GROUP BY chkid) t

 

3.通过查询进行更新的操作

UPDATE tb1
SET c1=b.c1 ,
c2=b.c2
FROM b
WHERE tb1.c3 = b.c3;

 

相关文章:

  • 2022-02-19
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-06
  • 2021-08-22
  • 2021-09-29
  • 2022-12-23
  • 2021-06-17
相关资源
相似解决方案