DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: Break on

  1. #1
    Join Date
    Apr 2001
    Posts
    60
    Hi
    break on deptno;
    select deptno,empno,ename,sal from emp order by deptno;

    The above sql query will suppress the deptno duplicate value. Is it possible to write a query and get the same result with out using break on deptno?
    rammi

  2. #2
    Join Date
    Apr 2002
    Posts
    291
    If i'm not wrong, u can use distinct for the deptno in the select query, this also avoids duplicates . but the thing is u've to specify the distinct only for one column and should be the first column in the select clause.

    Pls correct me any gurus , if i'm wrong
    PNRDBA

  3. #3
    Join Date
    Apr 2001
    Posts
    60
    Hi
    Using distinct will not solve the problem, if i am correct.
    rammi

  4. #4
    Join Date
    Nov 2000
    Posts
    178
    Hi ramya_ram,

    What exactly are you trying to do?


  5. #5
    Join Date
    Apr 2001
    Posts
    60
    Hi SC
    I want query to run where I can not use break on.
    rammi

  6. #6
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    Hi,
    break on ... is a command of SQL*Plus and has nothing to do with SQL.
    You cannot suppress duplicate values in a resultset of a single SQL query.
    Ales

  7. #7
    I do not understand what you want.
    First possibility:Yes, distinct will return distinct values of the entire result set, you are right. But you want only once dept. no, and combined with another columns in some result set. Logically, if you will not restrict some way the other combination in the result set, you have to have more that one row for one value of dept.no.
    Now think: you could use group by deptno. But, because the group by was very logically thinked, you will have to put in your group by list all the columns in select_list that are not agregates or constants. This is very logically stated! This is how the truth comes to the light.
    You want once every deptno, but with which values of employee etc.?


    Then, the other possible thread: you want all the values, but you want to display deptno only once. Then, this is a client issue. Solve in client or in sqlplus.
    ovidius over!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width