Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Sql Query Help -- Aggregating Rows
I just wanted to thank everyone who helped me, I really learned a lot!
Just to follow up to help others, I needed the 2006 and 2007 rows to not include once from both years. Basically you take the 1 for 2006 and then you subtract out the "both" column. Since both can't be 1 unless 2006 is 1, then you know you'll never get a negative result.
MAX(DECODE(substr(Inventory.ISSUEDATE,8,4),2006,1,0))- MAX(DECODE(substr(Inventory.ISSUEDATE,8,4), 2007,1,0))*MAX(DECODE(substr(Inventory.ISSUEDATE,8,4),2006,1,0)) Received on Mon Oct 29 2007 - 09:16:37 CDT