添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
含蓄的火柴  ·  R语言grf包 ...·  1 月前    · 
健身的煎鸡蛋  ·  Taycan Turbo ...·  4 月前    · 
How do I preform a query that returns the number of rows that meet a condition?

I assume its something like:



but i realize this is very wrong. help please?

thanks
Johann Dobbins wrote: How do I preform a query that returns the number of rows that meet a condition?

I assume its something like:



but i realize this is very wrong. help please?

thanks



to clarify, i don't want to simply do:



because the select query has a few join fetches and would be quite expensive if there are more than a certain number of records. so, i would like to first count the number of records and only populate a result set if the number is small enough.

thank you
Johann,

Take a look at the JPQL 'NEW' operator. That would really be the only way to do this. Otherwise, you could look into native queries.

Hope it helps,
Reza