• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Order by query..

 
Ranch Hand
Posts: 982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


I am getting an error in this query....Whats wrong with it...

Am using Oracle 8i.

select distinct deptno,ename,sal,comm
from emp order by ename, empno desc;

ERROR at line 2:
ORA-01791: not a SELECTed expression

When i remove empno and run,i am getting resultset...
but it is not necessary that a order by column should be selected...

then why is it giving error...

The following works fine..

Select deptno,job,ename from emp order by deptno,sal desc;

Regards
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read this
[ August 28, 2006: Message edited by: Srikanth Basavaraju ]
 
A Kumar
Ranch Hand
Posts: 982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Srikkanth!!!
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic