SQL LIKE句は、ワイルドカード演算子を使用して値を類似の値と比較するために使用されます。LIKE演算子と組み合わせて使用される2つのワイルドカードがあります。
The percent sign (%)
The underscore (_)
パーセント記号は、0文字、1文字、または複数文字を表します。アンダースコアは、単一の数字または文字を表します。記号は組み合わせて使用できます。
WHERE SALARY LIKE '%200%'
任意の位置に200がある値を検索します
したがって、条件に応じて、選択する月を含む変数を取得し、次のようなステートメントを入力します。
WHERE SALARYDATE LIKE '%mar%'
またはあなたのための他のいくつかのオプション
WHERE SALARY LIKE '200%' Finds any values that start with 200
WHERE SALARY LIKE '%200%' Finds any values that have 200 in any position
WHERE SALARY LIKE '_00%' Finds any values that have 00 in the second and third positions
WHERE SALARY LIKE '2_%_%' Finds any values that start with 2 and are at least 3 characters in length
WHERE SALARY LIKE '%2' Finds any values that end with 2
WHERE SALARY LIKE '_2%3' Finds any values that have a 2 in the second position and end with a 3
WHERE SALARY LIKE '2___3' Finds any values in a five-digit number that start with 2 and end with 3