簡體   English   中英

在SQL表達式字段中使用IF的Crystal報表

[英]Crystal Reports Using IF in SQL Expression Field

我剛剛開始使用Crystal Reports,並且嘗試將字段的值設置為value1或value2,如果該值為null。 我嘗試在SQL表達式編輯器的文本部分中輸入以下內容:

If IsNull({TABLE.Value1}) Then
{NewField} = (select Value2
    from TABLE where ID = {TABLE.ID})
Else
{NewField} = (select Value1
    from TABLE where ID = {TABLE.ID})

但我得到一個錯誤,指出:

ORA-00923:在預期位置找不到FROM關鍵字

請問我該如何工作?

我最終使它與:

If IsNull({TABLE.Value1}) or {TABLE.Value1} = "" then
    {TABLE.Value2}
else
    {TABLE.Value1}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM