2016-04-26 2 views
0

これは私の場合(SQL内)です。エラーが表示されます。 -ケース内で "and"と "in"を処理する方法

'I'付近の構文が正しくありません。

どうすれば対応できますか?

,case 
when UserType like 'Teacher/Instructor and Type like 'I have a student currently in a School' then 'Ok' 
else 'General' 

答えて

1

それは

,case when UserType like '%Teacher/Instructor%' and Type like 
'%I have a student currently in a School%' then 'Ok' else 'General' end 

LIKEとSQLでCASEのための構文を確認する必要があります。

0

あなたは引用符とキーワードEND不足している:それとは別に

case when UserType like 'Teacher/Instructor' 
    and Type like 'I have a student currently in a School' 
then 'Ok' 
else 'General' 
end 

を:LIKEは、col LIKE 'Ab%'として、ワイルドカード比較ですためのものです。 col LIKE 'Ab'のようなワイルドカードを使用しない場合は、col = 'Ab'の代わりに=という単純なものを使用してください。等価性だけを探しているときにパターンマッチングを行わなければならないとDBMSに伝えないでください。

0

いくつかの問題がここにあります

  1. あなたがそれを要約するとelse

endキーワードが含まれていない「インストラクター」

  • 後に終了引用符が欠落しています:

    case 
    when UserType like 'Teacher/Instructor' and 
    -- Issue #1 here ---------------------^ 
    Type like 'I have a student currently in a School' then 'Ok' 
    else 'General' 
    end -- Issue #2 here 
    
  • 関連する問題