個人筆記~~~
select a.id,a.log_at,to_char(to_timestamp(a.log_at/1000) AT TIME ZONE 'UTC-8','yyyy-MM-dd HH24:MI:SS') as time,b.profile::json->>'name',a.content
from lecture_user_records a,users b,lecture_records c
where a.lecture_record_id = c.id
and b.id = a.user_id
and c.lecture_id = '891a5a90-ff90-11e9-a409-97fc8f56cf4f'
order by a.id desc;
時間戳這裏是以毫秒計算,以秒計算的話不需要除以 1000
to_char(to_timestamp(a.log_at/1000) AT TIME ZONE 'UTC-8' ,'yyyy-MM-dd HH24:MI:SS') (沒弄明白爲什麼是-8轉換的結果纔是對的,不應該是+8嗎???)
查詢某個字段是json數據格式的其中某個值
b.profile::json->>'name',