Home » SQL & PL/SQL » SQL & PL/SQL » Group by on a view
Group by on a view [message #212100] Wed, 03 January 2007 16:42 Go to next message
montreal
Messages: 5
Registered: January 2007
Location: Montreal
Junior Member
Hello,

I can't do this simple query on an oracle view :

SELECT * FROM myview ORDER BY prix ASC GROUP BY id_pdt

Here's the error message :
Warning: ociexecute(): OCIStmtExecute: ORA-00933: SQL command not properly ended

Any idea what's going on ? Can't I do a group by on a view ? How can I work this around ?

Thanks in advance !

Helene

Re: Group by on a view [message #212106 is a reply to message #212100] Wed, 03 January 2007 17:30 Go to previous messageGo to next message
montreal
Messages: 5
Registered: January 2007
Location: Montreal
Junior Member
no, the problem unfortunately comes from something else... I tried to put the order clause after the group by but that's not it.
Are there any restrictions on certain types of views ?
What could be the problem ?
Re: Group by on a view [message #212118 is a reply to message #212100] Wed, 03 January 2007 18:29 Go to previous messageGo to next message
ksoule
Messages: 13
Registered: November 2003
Location: Austin, TX
Junior Member
This an example of how to use "order by" and "group by" which were not used properly in your statement.

the following link will help you.

http://www.db.cs.ucdavis.edu/teaching/sqltutorial/chap1-2.pdf

Re: Group by on a view [message #212133 is a reply to message #212100] Wed, 03 January 2007 23:11 Go to previous messageGo to next message
bsureysh
Messages: 17
Registered: January 2007
Location: india
Junior Member
While using Group, we need to give the column names as below..

SELECT channel_id, create_tsp FROM channel GROUP BY channel_id,create_tsp ORDER BY channel_id desc

Chk this ..!!
Re: Group by on a view [message #212140 is a reply to message #212100] Wed, 03 January 2007 23:54 Go to previous messageGo to next message
bsureysh
Messages: 17
Registered: January 2007
Location: india
Junior Member
Give the column names for the Group by

SELECT channel_id, create_tsp FROM channel GROUP BY channel_id,create_tsp ORDER BY channel_id DESC

chk this..!!
Re: Group by on a view [message #212277 is a reply to message #212100] Thu, 04 January 2007 08:31 Go to previous message
montreal
Messages: 5
Registered: January 2007
Location: Montreal
Junior Member
Thanks a lot all of you for your help !
I works !!
Previous Topic: problem in copying
Next Topic: Neither LPAD nor RPAD - is there a middle? (merged)
Goto Forum:
  


Current Time: Thu Dec 08 22:16:23 CST 2016

Total time taken to generate the page: 0.17528 seconds