求获取Expensive表date字段年份的JPA查询方法
Markdown Formatting Demo
Basic Text & List Examples
- This is a list item with italicized emphasized text.
- Another list item featuring bold emphasized text (using double asterisks for stronger emphasis).
- List item containing inline code:
SELECT * FROM Expensive WHERE user_id = :userId
Block Elements
This is a block quote, ideal for presenting quoted content or important notes.
For longer code blocks, use triple backticks:
@Query(value="SELECT DISTINCT DATE_PART('year', CAST(e.date AS DATE)) AS years " + "FROM Expensive e WHERE e.user_id = :userId AND e.date IS NOT NULL ORDER BY years DESC", nativeQuery = true) List<Integer> findDistinctYears(Long userId);
Links & Images
- Internal anchor link: Jump to demo heading
- Example image (placeholder):
Expense Year Chart
内容的提问来源于stack exchange,提问作者jayaraj
相关产品推荐
相关产品推荐

