原来的语句
select id,name,amount,sort,gift_id from (select id,name,amount,sort,gift_id,count(gift_id) from (select * from t_lpw_gift g join t_lpw_dianxin_gift d on g.id=d.gift_id) group by gift_id,id,name,amount,sort order by count(gift_id) desc) where rownum <=5;
差不多这样
createNativeQuery("select * from (select * from group by colnum1 order by count(colnum1) desc) where rownum <=5", "*"得到数据对于的实体类); 一直提示 列名无效
select id,name,amount,sort,gift_id from (select id,name,amount,sort,gift_id,count(gift_id) from (select * from t_lpw_gift g join t_lpw_dianxin_gift d on g.id=d.gift_id) group by gift_id,id,name,amount,sort order by count(gift_id) desc) where rownum <=5;
差不多这样
createNativeQuery("select * from (select * from group by colnum1 order by count(colnum1) desc) where rownum <=5", "*"得到数据对于的实体类); 一直提示 列名无效
------ ------------ -------- ------- --------
ID INTEGER
NAME VARCHAR2(32)
PRICE NUMBER
AMOUNT INTEGER
SORT VARCHAR2(32) Y
Name Type Nullable Default Comments
----------- ------- -------- ------- --------
GIFT_ID INTEGER
DIANXIN_ID INTEGER
GIFT_NUMBER INTEGER Y