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

高分,在oracle中 sql转hql

2012-10-23 
高分请教高手,在oracle中 sql转hqlJava codeselect tt.date1, count(tt.id)from (select t.user_id id,to_

高分请教高手,在oracle中 sql转hql

Java code
select tt.date1, count(tt.id)  from (select t.user_id id,               to_char(t.login_time, 'yyyy-mm') date1          from v2_user_login_log t         group by to_char(t.login_time, 'yyyy-mm'), t.user_id        having count(*) > 5) tt group by date1 order by date1 desc


[解决办法]
你这句话没用到特殊语法,应该没区别的。直接写就行了,

我自己是这么用的,不知道理解错了没。

<!-- 查询统计数据:属性值 -->
<select id="getStatisticsDataByOrgIndprocode2" parameterType="java.lang.String" resultMap="dataViewMap">
select * from 
(
${selectClause}
where indCode = #{indCode} and RangeMinDate &gt;= to_date(#{beginDate},'yyyymmdd') and RangeMinDate &lt;= to_date(#{endDate} ,'yyyymmdd')
<if test="indProCode != null"> and IndProCode=#{indProCode}</if>
<if test="province != null"> and Province =#{province}</if>
<if test="cityp != null"> and Cityp =#{cityp}</if>
<if test="region != null"> and Region =#{region}</if>
<if test="orgCode != null"> and OrgCode =#{orgCode}</if>
<if test="deptCode != null"> and DeptCode =#{deptCode}</if>
${groupByClause}
) ${pivotClause}
</select>
[解决办法]
是HIVE-QL吗?
SQL code
select tt.date1, count(tt.id)  from (select t.user_id id,               SUBSTR(t.login_time,1,7) date1          from v2_user_login_log t         group by SUBSTR(t.login_time,1,7), t.user_id        having count(*) > 5) tt group by date1 order by date1 desc 

热点排行