2
我正在通過ODBC爲OpenEdge數據庫創建if語句。查詢我有像魅力,但進展要我定義的if語句不同,我不知道。有沒有人可以爲我定義正確的查詢?IF THEN SQL中的語句與OpenEdge
IF
{Crediteur code|type=string} = 'HOEFASTE'
BEGIN
(SELECT
inok."vest-kd-arvo"+RTRIM('-') + RIGHT(CAST((inok."inok-nr" + 1000000) AS varchar(7)),6) AS inokvalue
,RTRIM("leso-kd")+RTRIM('-')+inok."vest-kd-arvo"+RTRIM('-')+CAST("inok-nr"AS varchar(6)) AS inokdisplay
,RIGHT(CAST((inok."inok-nr") AS varchar(7)),6) + '-' + inok."vest-kd-arvo" + '-' + RTRIM("leso-kd") AS inoknr
,RTRIM("leso-kd") AS soortfact
FROM
PUB.inok
WHERE
inok."vcdc-nr" = {Administratie|type=int32}
AND inok."inss-kd" NOT IN ('H','G')
)
ELSE
(SELECT
inok."vest-kd-arvo"+RTRIM('-') + RIGHT(CAST((inok."inok-nr" + 1000000) AS varchar(7)),6) AS inokvalue
,RTRIM("leso-kd")+RTRIM('-')+inok."vest-kd-arvo"+RTRIM('-')+CAST("inok-nr"AS varchar(6)) AS inokdisplay
,RIGHT(CAST((inok."inok-nr") AS varchar(7)),6) + '-' + inok."vest-kd-arvo" + '-' + RTRIM("leso-kd") AS inoknr
,RTRIM("leso-kd") AS soortfact
FROM
PUB.inok
WHERE
inok."rela-kd-kre" = {Crediteur code|type=string}
AND inok."vcdc-nr" = {Administratie|type=int32}
AND inok."inss-kd" NOT IN ('H','G')
)
END
據我所知,這是我需要的解決方案!我現在要測試。 – Bouwplaats