行列转换后分页出错,求帮组,急急急!!!
这是我行列转换的的sql
select c.* from (
select legal_entity_id,process_date,record_id,amount from engine_fp where process_date='2013-06-25'
) s pivot (max(amount) for record_id in([23],[24],[25],[26],[27],[28],[29],[30],[31],[33],[34],[38]))
c order by legal_entity_id
WITH query AS (
SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__
FROM (
select TOP(40) c.* as page0_ from (
select legal_entity_id,process_date,record_id,amount from engine_fp where process_date='2013-06-25'
) s pivot (max(amount) for record_id in([23],[24],[25],[26],[27],[28],[29],[30],[31],[33],[34],[38]))
c order by legal_entity_id
) inner_query
) SELECT page0_ FROM query WHERE __hibernate_row_nr__ >= 20 AND __hibernate_row_nr__ < 40
WITH query AS (
SELECT inner_query.*, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__
FROM (
select TOP(40) * from (
select legal_entity_id,process_date,record_id,amount from engine_fp where process_date='2013-06-25'
) s pivot (max(amount) for record_id in([23],[24],[25],[26],[27],[28],[29],[30],[31],[33],[34],[38]))
c order by legal_entity_id
) inner_query
) SELECT legal_entity_id,process_date,record_id,amount
FROM query WHERE __hibernate_row_nr__ >= 20 AND __hibernate_row_nr__ < 40