0
如何將此轉換下面的查詢等效teradate查詢。我嘗試過,但結果變化很大。轉換Oracle查詢的到Teradata的查詢
select il.domainN as listname, il.SourceID, ns.sourcename, cbo.customerid, cu.username, hv.domainN as HTname
, nvl((select 1
from mydb.customerPP cpp
where cbo.customerid = cpp.customerid
and NOT EXISTS (select 1 from mydb.customerPI cpt where cpp.customerid = cpt.customerid)
and trunc(cpp.startdate) <= sysdate
group by cpp.customerid),0) as BBID
from mydb.customerBO cbo
join mydb.customers cu on cbo.customerid = cu.customerid
join mydb.inv il on cbo.domainN = il.domainN
join mydb.Sources ns on il.SourceID = ns.SourceID
left join mydb2.HT hv on (il.domainN = hv.domainN
and hv.sDate+1 >= il.dDate
and il.dDate+1 >= hv.sDate)
where cbo.customerBOID = 1
and cu.statusid = 1
and il.sourceTID = 2
and il.joinbydate >= cbo.cDate
and trunc(il.dDate) = trunc(sysdate)
謝謝。
你試過了什麼? –
@GergelyBacso我只是改變hv.sDate + 1和il.dDate + 1日期+ inetrval「1」有一天,它成功運行,但結果是不一樣的。我認爲還有其他事情需要改變,或者我做錯了。 – user3438498
更改爲' +間隔 '1' DAY'和改變'sysdate'到'CURRENT_DATE'應該做的伎倆。其他一切都很好。 –
JNevill