iT邦幫忙

0

sql語法應用的問題

  • 分享至 

  • twitterImage

請教大家
在postgresql執行下列語法的時候
select (t2.data-t1.data) as data from log2 as t1 inner join content as t2 on t1.id3=t2.id.
會出現下列的訊息
error: operator does not exist character=bigint
Hint : No operator matches the given name and argument type(s). You might need to add explicit type casts.
是否有轉換的函數可使用在此情況呢?煩請大家指點迷津 感謝

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

0
石頭
iT邦高手 1 級 ‧ 2017-11-20 20:50:03
最佳解答

CAST (data AS INTEGER)

可參考

ektrontek iT邦研究生 1 級 ‧ 2017-11-23 20:36:30 檢舉

感謝幫忙

0
jimmy10243
iT邦見習生 ‧ 2017-11-23 11:33:23
  1. 依錯誤訊息 sql script 的問題比較小. 先確認一下 t2.data, t1.data 資料是否都是數值
    特別是 space 及標點符號.... 夾雜在資料內

  2. 如果 資料都對 再去找極大值是否超過datatype 的 range

  3. 再找不出原因,把 schema 貼出來 研究

ektrontek iT邦研究生 1 級 ‧ 2017-11-27 15:40:58 檢舉

使用下列語法select count() as total1 from content where contenttype='Page' and creationdate between '2017/6/1' and '2017/6/30' and spaceid=18776103
與 select id4 from log2 where id3=18776103' and id2='7'
要如何將兩個語法的 id4與 total1來做相減運算呢?感謝

我要發表回答

立即登入回答