SQL command not properly ended

VS2005
VB.NET
I am running the following query and am getting the error: "SQL command not properly ended".  I have changed the query in every way possible but still get the error.
Any advice would be great.
Thanks.
SELECT broadcastmonth, sum(projectedgross), sum(projectedagencydiscount), sum(projectedrepdiscount), sum(projectedotherdiscount), aeinitials FROM revenue GROUP BY aeinitials, broadcastmonth WHERE network<>'VOD' AND network<>'WEB' AND network<>'CRAL'

Open in new window

DO-ORACLE.jpg
wayneburrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rajvjaCommented:
Hi
 Give aliases to the columns.
SELECT broadcastmonth, sum(projectedgross) Col1, sum(projectedagencydiscount) Col2, sum(projectedrepdiscount) Col3, sum(projectedotherdiscount) Col4, aeinitials FROM revenue GROUP BY aeinitials, broadcastmonth WHERE network<>'VOD' AND network<>'WEB' AND network<>'CRAL'
0
DavidSenior Oracle Database AdministratorCommented:
I don't see how aliases will change the incorrect parsing.  However, in Oracle SQL your group-by and where clauses are reversed.
0
wayneburrAuthor Commented:
I added the alias's and get the same results:


SELECT broadcastmonth, sum(projectedgross) col1, sum(projectedagencydiscount) col2, sum(projectedrepdiscount) col3, sum(projectedotherdiscount) col4, aeinitials FROM revenue GROUP BY aeinitials, broadcastmonth WHERE network<>'VOD' AND network<>'WEB' AND network<>'CRAL'

Open in new window

DO-ORACLE-2.jpg
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

rajvjaCommented:
SELECT broadcastmonth, sum(projectedgross) col1, sum(projectedagencydiscount) col2, sum(projectedrepdiscount) col3, sum(projectedotherdiscount) col4, aeinitials FROM revenue
WHERE network<>'VOD' AND network<>'WEB' AND network<>'CRAL'
GROUP BY aeinitials, broadcastmonth

where clause comes before group by
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Devinder Singh VirdiLead Oracle DBA TeamCommented:
Syntax of select statement should be like
SELECT <columns> FROM <table> WHERE <CONDITIONS>
GROUP BY <grouping column> HAVING <filetring condion of group by>

and in your case group by comes before where clause.
0
DavidSenior Oracle Database AdministratorCommented:
Glad to see y'all agreeing with me :)
0
wayneburrAuthor Commented:
Moved the Group by after the where clause and problem solved!
0
Devinder Singh VirdiLead Oracle DBA TeamCommented:
Yes I agree with your answer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.