0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

MyBatis内のSQL <![CDATA[ 比較演算子 ]]>

Last updated at Posted at 2020-12-08

Mapper.xmlファイル内のSQLで引っかかったので個人的メモ。

Mapper.xml
'select  A.cutromer_id
        ,A.number
        ,case
           when B.customer is not null and B.customer <![CDATA[<>]]> ''
           else ''
         end AS C
 from A
 left join B
   on A.cutromer_id = B.cutromer_id'

MySQLに読み替える際、を除いて書き換える必要がありました。
*比較演算子はちゃんと書く。

MySQL.
'select  A.cutromer_id
        ,A.number
        ,case
           when B.customer is not null and B.customer <> ''
           else ''
         end AS C
 from A
 left join B
   on A.cutromer_id = B.cutromer_id'

MyBatisはXMLファイルにSQL文を定義して使用する。
XMLなので比較演算子が直接、使えないのがわかっていたつもりでした💦

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?