|
-
Yikes, but you need to learn how to format your SQL.
Basically, you can't mix and match aggregates and non-aggregates. Windowed Analytical functions, while sharing the name of aggregate functions, are actually *not* aggregate functions. So, you can't say... If the sum of all the records is 5, then return 6, if each record is 5, then return 7.
You can't have SUM() at the same level as SUM() OVER.
It's pretty self-evident, so I'm not sure what else to say.
Also, there is absolutely no point to that nasty TRIM(TO_CHAR thing you're doing. Since we're already dealing with a number, there's no point to converting it to a char so you can trim it. You're only making things slower for no good reason.
- Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|