You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求获取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);

内容的提问来源于stack exchange,提问作者jayaraj

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 13:07:37