在postgresql8.4以后,postgresql添加了window函数。
像rank(),row_number(),partion等等,用法和slqserver一模一样。
SELECT *, ROW_NUMBER() over (PARTITION By task_id order by ACTION_TIME ) as rowId FROM CAMPAIGN_TASK_LOG where CAMPAIGN_TASK_LOG.AFTER_state in('10','15','21','22','23','24') and ACTION_TYPE='surveysubmit'
refurl:http://my.oschina.net/Kenyon/blog/79543