首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

剽悍HQL

2012-12-26 
强悍HQLselect order.id, sum(price.amount), count(item)from Order as order? ? join order.lineItems a

强悍HQL

select order.id, sum(price.amount), count(item)

from Order as order

? ? join order.lineItems as item

? ? join item.product as product,

? ? Catalog as catalog

? ? join catalog.prices as price

where order.paid = false

? ? and order.customer = :customer

? ? and price.product = product

? ? and catalog.effectiveDate < sysdate

? ? and catalog.effectiveDate?

>= all (

? ? ? ? select cat.effectiveDate

? ? ? ? from Catalog as cat

? ? ? ? where cat.effectiveDate < sysdate

? ? )

group by order

having sum(price.amount)?

> :minAmount

order by sum(price.amount) desc

热点排行