表的结构是这样的:
[img]http://dl.iteye.com/upload/attachment/0075/2813/5aced532-0f10-3e47-a054-8b608aa37ab7.png[/img]
现在想把所有featured为1或2的查询出来,1中的结果按照date排序,2中的结果也按date排序,featured=1的所有结果排在2的前面,不管日期如何,这样的HQL语句如何写啊?
先谢~~
表的结构是这样的:
[img]http://dl.iteye.com/upload/attachment/0075/2813/5aced532-0f10-3e47-a054-8b608aa37ab7.png[/img]
现在想把所有featured为1或2的查询出来,1中的结果按照date排序,2中的结果也按date排序,featured=1的所有结果排在2的前面,不管日期如何,这样的HQL语句如何写啊?
先谢~~
select id,featured,date from table where featured in (1, 2) order by featured,date
再转成hql 即可
from Model where featured in (1, 2) order by featured,date