Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ecivgamer
Starting Member
7 Posts |
Posted - 2014-01-17 : 13:36:21
|
Hi all, my need is to count the quantity of payments with 20000 step. This is my Oracle code. I'm in process of moving from Oracle to SQL Server. Please, be so kind, help me to rewrite this code for SQL Server. Thanks ahead. WITH got_grps AS( SELECT TRUNC (sys_creation_date) AS date_creation , ( 1 + FLOOR ( NVL (amount_original, 0) / 20000 ) ) * 20000 AS grp_20000 FROM event_log WHERE sys_creation_date BETWEEN SYSDATE - 1000 AND SYSDATE AND policy_action = 'REVIEW' AND NVL (amount_original, 0) >= 1 )SELECT date_creation, grp_20000, COUNT (*) AS cntFROM got_grpsGROUP BY date_creation, grp_20000ORDER BY date_creation, grp_20000 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|