Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
birthDate(時間なしの)列を持つテーブルからいくつかのレコードを取得する必要がありますDate。年と月のみと比較してレコードをフィルタリングする必要があります。たとえば、1990年3月に生まれたすべてのユーザーが欲しいです。日は関係ありません。
birthDate
Date
どのように処理しますか?
これを使用するfrom Entity where to_char(birthDate,'YYYY/MM') = '1990/03' と、HQLで機能し ます
from Entity where to_char(birthDate,'YYYY/MM') = '1990/03'
あなたはこれを試すことができます
select * from table where month(birthdate)=03 and year(birthdate)=1990