simple query help :)

I have table with date, customer number, salary... Now, I want to extract the total number of client whose salary is between 2000 and 3000 and deposited consistantly for the last 6 months.
Can someone help me with this...

user12183668 wrote:
I used your query... its working well... but there are a few County for the date (NTC) which I am less than 6... .and I want to exclude these documents at the level of the query.

How can I do this

By encapsulating the query as an interior view, something in this way:

select *
  from (
select
 empno
,count(distinct trunc(hiredate,'MM')) cnt
from emp
where
sal between 2000 and 3000
and
hiredate >= add_months (trunc(sysdate, 'MM'), -5 )
group by empno
) a
where a.cnt = 6;

Tags: Database

Similar Questions

  • The simple query help

    Hello! I have a simple request: NO of ROAD_TYPE = "RAMP" or NO FUNC_CODE = 7 FUNC_CODE or NOT = 0 or NOT FUNC_CODE = NULL, each element of the query by itself without problem, tracks, but linked together in this way with the GOLD, one of them opts on. What I am doing wrong?

    It's the difference between OR and and.

    Think about this simple example

    Where Column != A or Column != B.
    

    Excluding the Null handling, it's true. Because for the first condition, it will be true for all but one, and the second condition will be true for A. You need an AND, not a RC.

    For simplicity and readability without doubt, use an In operator, and group together them. It would therefore be:

    Where Road_Type != 'RAMP' and Func_Code Not In('0, 7) and Func_Code is not Null
    
  • Problem with a simple query

    Hello, I'll start by saying that I am a noob. in any case, I'm trying to do what I thought was a simple query for records that are greater or equal to the date of the day: it's my request...

    < cfquery name = "getUpcoming" datasource = 'events' >
    SELECT title, eventDate FROM event WHERE eventDate > = #Now () # ORDER BY ASC eventDate
    < / cfquery >

    It works, so, I get the records that are greater than the current date, but all records that match to are not.

    I guess that it is looking at the time as well, or should I completely wrong. I do not know? Any help would be greatly appreciated.

    Good reading up on top of (http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f 6f.html), which you must use when you pass dynamic values to the DB, instead of hard-coding the in your SQL string.  And when using , use a param of CF_SQL_DATE type, and must ignore the time portion of the date/time value, you pass (I'm not 100% certain of this... only about 99% certain... but give it a go).  Or spend only the date part of the date/time value in the query.  Using createOdbcDate() fact, without all the extra horsing around adding things together and using the dateFormat() attribute as the previous poster suggested.

    --

    Adam

  • Simple query in Oracle Table in MS Access causes a full table scan.

    I run a very simple query in MS ACCESS to an Oracle table attached as follows:

    Select *.
    EXPRESS_SERVICE_EVENTS-(EXPRESS is the name of the related table. SERVICE_EVENTS)
    When executed > MyDate()

    or

    Select *.
    EXPRESS_SERVICE_EVENTS-(EXPRESS is the name of the related table. SERVICE_EVENTS)
    When executed > [Forms]! [MyForm]! [Date1]

    We have more than 50 machines and this query works well on more than half of them, using an Oracle Index on the field "run." Exactly the same thing running on other machines results in a full table scan, so regardless of the index (the DB access even access all machines).

    Strangely, if we write the query as follows:

    Select *.
    Of EXPRESS_SERVICE_EVENTS
    When executed > # 2009-09-04 08:00 #.

    It works fast everywhere!

    Any help with this "phenominon" would be appreciated.

    We did the things:
    Check the locale settings of the ODBC driver, MS Access settings (as in tools-> Options), we have the latest XP and Office service packs and re-related all the Access Tables on the slow and fast machines independently).

    All machines use the same version of the ODBC driver?

    If you have access to Metalink, check the following note:
    Note.257828.1 Scan of Table full Ext/Pub while seeking the DATE columns using the ODBC Oracle driver:

    In a Word, try "bind timestamp date" option in the dsn configuration and do not forget to update the links in the table.

    It will be useful,
    Greg

  • SQL Query help find albums from sale

    Hi Experts,

    I have the following data and the need to find the book Top sold in each type.

    Book Type QTY

    20Help the3
    10Kitchen1
    5Navigation2
    30Help the4

    Please let me how can know we get this simple SQL help?

    Thank you

    Bharat

    Hello

    Bharat Hegde wrote:

    Hi all

    I tried to use Dense_rank as below. But it gives me the top selling books. I need high library in each type...

    This looks like a job for 'PARTITION BY type

    For example:

    WITH got_rnk AS

    (

    SELECT b.bid, b.type

    SUM (o.quantity) AS total_quantity

    DENSE_RANK () OVER ( PARTITION BY b.type

    ORDER OF SUM (o.quantity) / / DESC

    ) AS rnk

    B BOOK

    o order1

    WHERE b.bid = o.bid

    GROUP BY b.bid, b.type

    )

    SELECT total_quantity, type submission

    OF got_rnk

    WHERE rnk = 1

    ;

    . Aggregate functions (such as the SUM, above) are calculated before analytical functions, so an analytic function (such as DENSE_RANK above) may depend on an aggregate function; you don't need a separate subquery for that.

  • A simple query with as wrong return result

    Hello

    I run a simple query with like.
    If I use the parameter I get incorrect results.
    If I use the request without parameter results are ok.

    My script:

    ALTER SESSION SET NLS_SORT = BINARY_CI;
    ALTER SESSION SET NLS_COMP = LINGUISTIC;

    -drop table abcd;
    create table abcd (col1 varchar2 (10));

    INSERT INTO VALUES ABCD ('122222');
    insert into abcd values ('111222');


    SELECT * FROM ABCD WHERE COL1 LIKE: 1. -bad result with 12%
    /*
    COL1
    ----------
    122222
    * 111222 *.
    */

    "Select * ABCD where col1 like 12%; -result ok
    /*
    COL1
    ----------
    122222
    */

    I use Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
    and query, run in Oracle SQL Developer 3.1.07.

    I think it's just a bug, and it is set to 11.2.0.3:

    11.2.0.1:

    DB11.2.0.1>> select * from v$version where rownum=1;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    
    1 row selected.
    
    DB11.2.0.1>> ALTER SESSION SET NLS_SORT=BINARY_CI;
    
    Session altered.
    
    DB11.2.0.1>> ALTER SESSION SET NLS_COMP=LINGUISTIC;
    
    Session altered.
    
    DB11.2.0.1>> create table abcd (col1 varchar2(10));
    
    Table created.
    
    DB11.2.0.1>> INSERT INTO ABCD VALUES ('122222');
    
    1 row created.
    
    DB11.2.0.1>> insert into abcd values ('111222');
    
    1 row created.
    
    DB11.2.0.1>> VARIABLE A1 VARCHAR2(10);
    DB11.2.0.1>> EXEC :A1 := '12%';
    
    PL/SQL procedure successfully completed.
    
    DB11.2.0.1>> SELECT * FROM ABCD WHERE COL1 LIKE :A1;
    
    COL1
    ----------
    122222
    111222
    
    2 rows selected.
    

    11.2.0.3:

    DB11.2.0.3>> select * from v$version where rownum=1;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    
    1 row selected.
    
    DB11.2.0.3>> ALTER SESSION SET NLS_SORT=BINARY_CI;
    
    Session altered.
    
    DB11.2.0.3>> ALTER SESSION SET NLS_COMP=LINGUISTIC;
    
    Session altered.
    
    DB11.2.0.3>> create table abcd (col1 varchar2(10));
    
    Table created.
    
    DB11.2.0.3>> INSERT INTO ABCD VALUES ('122222');
    
    1 row created.
    
    DB11.2.0.3>> insert into abcd values ('111222');
    
    1 row created.
    
    DB11.2.0.3>> VARIABLE A1 VARCHAR2(10);
    DB11.2.0.3>> EXEC :A1 := '12%';
    
    PL/SQL procedure successfully completed.
    
    DB11.2.0.3>> SELECT * FROM ABCD WHERE COL1 LIKE :A1;
    
    COL1
    ----------
    122222
    
    1 row selected.
    

    Kind regards
    Sayan Malakshinov
    http://orasql.org

  • Not sure if I can do this with a simple query.

    CREATE TABLE primary_table (SSN VARCHAR2 (15) VARCHAR2 (30) FIRST_NAME, LAST_NAME VARCHAR2 (30), VARCHAR2 (20)) of the STATE;

    insert into primary_table VALUES ('111-11-1111, 'Elvis', 'Presley', 'ACTIVE');
    insert into primary_table VALUES (222-22-2222', 'Gift', 'King', 'ACTIVE');
    insert into primary_table VALUES ('33-333-3333, 'Lex', 'Harrison', 'ACTIVE');

    CREATE TABLE secondary_table (SSN VARCHAR2 (15) NOT NULL, ARRIVAL DATE, NUMBER of LENGTH_OF_STAY);

    insert into secondary_table VALUES ('11-111-1111 ", 1 January 2011", 10);
    insert into secondary_table VALUES (' ' 222-22-2222 ", March 1, 2011", 10);
    insert into secondary_table VALUES (' ' 222-22-2222 ", June 1, 2011", 20);
    insert into secondary_table VALUES ('' 33-333-3333, January 1, 2011 ", 10);

    ========================================================================================

    Hello

    I created two very simple tables for this exercise. I don't know if I can do this with a simple query, or must use pl/sql.

    I want to join primary_table secondary_table of SSNand list the fields of primary_table, but only if the join returns only a line.

    In other words, I would like to create a list of data primary_table for primary_table lines that have only one line on the secondary table.


    Concerning

    RF25 wrote:
    CREATE TABLE primary_table (SSN VARCHAR2 (15) VARCHAR2 (30) FIRST_NAME, LAST_NAME VARCHAR2 (30), VARCHAR2 (20)) of the STATE;

    insert into primary_table VALUES ('111-11-1111, 'Elvis', 'Presley', 'ACTIVE');
    insert into primary_table VALUES (222-22-2222', 'Gift', 'King', 'ACTIVE');
    insert into primary_table VALUES ('33-333-3333, 'Lex', 'Harrison', 'ACTIVE');

    CREATE TABLE secondary_table (SSN VARCHAR2 (15) NOT NULL, ARRIVAL DATE, NUMBER of LENGTH_OF_STAY);

    insert into secondary_table VALUES ('11-111-1111 ", 1 January 2011", 10);
    insert into secondary_table VALUES (' ' 222-22-2222 ", March 1, 2011", 10);
    insert into secondary_table VALUES (' ' 222-22-2222 ", June 1, 2011", 20);
    insert into secondary_table VALUES ('' 33-333-3333, January 1, 2011 ", 10);

    ========================================================================================

    Hello

    I created two very simple tables for this exercise. I don't know if I can do this with a simple query, or must use pl/sql.

    I want to join primary_table to secondary_table of NSSand the list of fields in the primary_table, but only if the join returns only a line.

    In other words, I would like to create a list of data primary_table for primary_table lines that have only one line on the secondary table.

    Concerning

    Something like...

    select p.
    from primary_table p
    where p.ssn in (select s.ssn from secondary_table s group by s.ssn having count(*) = 1)
    
  • Improve a simple query

    Here's a simple query, what I want to know, I added superior select d.name, which is the description of region_code for. Can I get a whole result with a single statement select

    SELECT t.region_code, d.name, t.emp_contr
    Of
    (SELECT c.br_region_fo_code as Region_Code,
    Sum (c.employer_contribution) AS emp_contr
    OF core_business.cb_contr_emp_pmt_slip c
    T GROUP BY c.br_region_fo_code),
    general_information.cb_region_fo d
    WHERE t.br_region_fo_code = d.region_fo_code;

    Try this:

    SELECT c.br_region_fo_code as Region_Code,
               d.name,
               SUM(c.employer_contribution) OVER(PARTITION BY  c.br_region_fo_code ORDER BY c.br_region_fo_code) AS emp_contr
    FROM   core_business.cb_contr_emp_pmt_slip c,
               general_information.cb_region_fo d
    WHERE
               c.br_region_fo_code = d.region_fo_code;
    
  • help me with this simple query

    Hi, I have reached the results by querying the table twice. so, how can I get the results by hitting the table only once.
    version 10g
    with t as 
    (select 100 parent , 1 child , 'Y' flag from dual union all
    select 100 parent , 2 child , 'N' flag from dual union all
    select 100 parent , 3 child , 'N' flag from dual union all
    select 100 parent , 4 child , 'N' flag from dual union all
    select 100 parent , 5 child , 'Y'  flag from dual union all
    select 100 parent , 6 child , 'N' flag from dual union all
    select 100 parent , 7 child , 'N' flag from dual union all
    select 100 parent , 8 child , 'Y' flag from dual union all
    select 100 parent , 9 child , 'N' flag from dual)
    select * from t where parent in ( 
    select parent from t
    where child = 1)
    and flag = 'N'
    order by child;

    Hello

    Here's one way:

    WITH     got_good_cnt     AS
    (
         SELECT     t.*
         ,     SUM (CASE WHEN child = 1 THEN 1 END)
                  OVER (PARTITION BY  parent)          AS good_cnt
         FROM    t
    )
    SELECT       *     -- or list all columns except good_cnt
    FROM       got_good_cnt
    WHERE       good_cnt >= 1
    AND       flag        = 'N'
    ORDER BY  child
    ;
    

    The best way may depend on your data, for example, the columns that are unique.

    Each line in your sample data has the same value for parent. Is this the best game of test data?

  • Simple query sum I need help please

    I need an application to do something like this:

    Select customer_site_use_id
    of ar_payment_schedules_all ps
    where ps.status = "OP".
    AND NVL (ps.receipt_confirmed_flag, 'Y') = 'Y '.
    and exists (select (sum (ps1.acctd_amount_due_remaining) as amtdue)
    of ar_payment_schedules_all ps1
    where ps1.customer_site_use_id = ps.customer_site_use_id
    and (amtdue < 0)
    and ps.customer_site_use_id = 1593

    I can do this too difficult. I don't know if I need it is clause and the second select statement. In it are statement, if the sum of all the acctd_amount_due_remaining in ar_payment_schedules_all for the same customer_site_use_id is less than 0, then it is in the results.

    Hello

    user13444294 wrote:
    Hello

    I'm just starting to post on the site. I see what you mean on the information that I need to add. I think that what you gave me but is close, the only question I have is it would start really with statement "? I have never seen it before.

    Yes, the request begins with the keyword WITH. Try it.

  • Helps the simple query XPath in OSB

    Hello!

    I try to extract a part of XML with Oracle Service Bus using XPath message, but I can't find the way to make

    For testing purposes, I initialize a variable 'test' with an action of assignment with the following content:

    < Country > < country > < COUNTRY > ARE < / COUNTRIES > < S EU_COUNTRY > < / EU_COUNTRY > < Spain NUMBER > < / NUMBER > < ID > 1 < /ID > < country > < / country >

    Can I use following code to access the COUNTRY element but I get blank result:

    $test, Countries, Country, COUNTRY / text)

    I'm rather new to XPath, but I think that this expression should work.

    Could someone give me some advice?

    Thank you.

    Published by: user542345 on June 15, 2011 09:06

    Use

    $test / country/COUNTRY/text)

  • Choice of the message can be changed in the table of search results Simple query region?

    Hi friends,

    I have a Simple search query region in 11i.

    I created the SearchVO and bound to the query Table Region.

    I have two attributes MessageStyleText and a MessageChoice attribute in the simple search criteria.

    Search results show very well for all attributes.

    But when I search with the criteria of MessageChoice, in the table of results, this attribute MessageChoice is indicated as editable, display the drop-down list.

    I did this attribute ReadOnly = True but then it becomes readonly in search also. So this dosent help.

    I need to this drop-down list of MessageChoice be modifiable in the search criteria, but read in the table of results.

    Please help me with the resolution. Its kinda urgent.

    Would appreciate any help.

    Thank you

    Rajesh

    He solved.

    Added programmatically in code.

    Kept the attribute as MessageChoice in the query Table Region.

    Added to the controller

    ' Public Sub processRequest (pageContext OAPageContext, OAWebBean webBean)

    {

    super.processRequest (pageContext, webBean);

    OAM OAApplicationModule = pageContext.getRootApplicationModule ();

    OAMessageChoiceBean = processFlagMessageChoice

    (OAMessageChoiceBean) webBean.findChildRecursive ("AttributeId");

    processFlagMessageChoice.setReadOnly (true);

    }

  • simple query... but could not

    CREATE TABLE person_del
    (
    DNO VARCHAR2 (5).
    place VARCHAR2 (10),
    EU VARCHAR2 (10)
    )

    commit;

    insert into person_del values('1','home','Y')

    insert into person_del values('1','office','N')

    insert into person_del values('1','other','Y')

    insert into person_del values('2','office','Y')

    insert into person_del values ('3', 'home', 'n')

    insert into person_del values ('3 ', 'Office', 'Y')

    insert into person_del values ('4 ', 'other', 'n')

    insert into person_del values ('5', 'home', 'Y')

    insert into person_del values ('6', 'home', 'n')

    insert into person_del values ('6', 'Office', 'n')

    insert into person_del values ('7', 'home', 'Y')

    insert into person_del values ('7 ', 'Office', 'Y')

    commit;

    Select * from person_del

    Select the dno, place, got,
    -case when am = 'Y', and then 'Y '.
    Another null
    end as "won".
    of person_del
    where to put in ("home", "office")


    I ran the query above, but the result is not what I wanted
    The condition is as follows:
    List Y in a new column "earned" for these dno who reached the place - home or office
    If a = Y for the home place and GOT = N for the Office of the place, then only view this column where OBTAINED = Y
    If a = N to the home place and GOT = Y for the Office of the place, and then view only this column where OBTAINED = Y
    If both are N then list a any column
    If the two are then all a fo the column in the list
    The place else is not taken into account
    The output should be dno and won the column

    I know it's simple... but I couldn't do it and I need it in a few minutes
    Can someone help me on this using the CASE statement or something that is not difficult to understand the ASAP?

    Basically, the output of it should be as follows:

    DNO has won
    1. IS
    3 8
    2 8
    8 4
    6 N
    7. THERE

    What:

    SQL> select dno
      2  ,      got won
      3  from ( select dno
      4         ,      got
      5         ,      row_number() over (partition by dno, got order by dno, got desc) cnt
      6         from   person_del t
      7         where  t.place in ('home', 'office')
      8       )
      9  where ( case
     10            when got = 'Y' and cnt = 1 then 1
     11            when got = 'N' and cnt = 2 then 1
     12          end
     13        ) = 1;
    
    DNO   WON
    ----- ----------
    1     Y
    2     Y
    3     Y
    5     Y
    6     N
    7     Y
    
    6 rows selected.
    
  • Why XML XML Simple query on Table Eval does not work?

    I have a request that a simple select on a binary xml table on 11.2.0.1:
    SELECT xmlcast(xmlquery('$p/eval/@evalId' passing e.object_value AS "p" RETURNING CONTENT)
    AS VARCHAR2(30)) "EVAL ID"
    FROM eval e
    WHERE xmlexists('declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";
    /eval[@evalId=$eval_id]' PASSING object_value, 'RickBlanchard9972' as "eval_id");
    Now this xml document exists as a record in the binary xml table with evalId = "RickBlanchard9972" attribute
    <?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?><eval createdById="1957" acmeMemberId="37e6f05a-88dc-41e9-a8df-2a2ac6d822c9" category="external" eval_dt="2012-02-11T23:47:02.645Z" evalId="RickBlanchard9963" xmlns="http://www.cigna.com/acme/domains/eval/2010/03" xmlns:ns2="http://www.cigna.com/acme/domains/derived/fact/2010/03" xmlns:ns3="http://www.cigna.com/acme/domains/common/2010/03">
       <derivedFacts>
          <ns2:derivedFact>
             <ns2:defId>888</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52600:2</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>null</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>777</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52599:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>INT</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>666</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:51400:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>integer</ns2:type>
                <ns2:value>32</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>555</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52177:3</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>null</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>444</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52075:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>F</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>333</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:51392:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>222</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52837:2</ns2:defUrn>
             <ns2:factSource>CCDR CaseManagement</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
       </derivedFacts>
    </eval>
    Unfortunately, the query returns with a null value instead of; RickBlanchard9963


    Must be something obvious missing here...
    Any help is appreciated.

    Kind regards
    Rick Blanchard

    The sample document contains evalId = "RickBlanchard9963", not "RickBlanchard9972" but it's probably a typo?

    The real problem is that you are missing from the default namespace declaration in XMLQuery.

  • Cannot get this simple query!

    Hi guys,.

    There is this requirement easy to write a query that selects many columns in a table, but grouped on 3 columns in the same table.

    Table Str:
    C11 col2 col3 col4 col5 col6 col7 col8 col9 col10

    Mandatory:
    Group By: Col9, col10
    Columns to select: C11 col2 col3 col4 col5 col6 col7 col8

    I know there is something simple that I'm missing.

    any help will be appreciated.

    Thank you!

    Hello

    What produces the output you asked for the data that you have posted:

    SELECT       MIN (col1)
    ,       MIN (col2)
    ,       MIN (col3)
    ,       MIN (col4)
    ,       MIN (col5)
    ,       MIN (col6)
    ,       MIN (col7)
    ,       MIN (col8)
    ,       col9
    ,       col10
    FROM       str
    GROUP BY  col9
    ,       col10
    ;
    

    If the fact

    WITH     got_rnum     AS
    (
         SELECT  str.*
         ,     ROW_NUMBER () OVER ( PARTITION BY  col9
                             ,             col10
                             ORDER BY        col1
                             ,             col2
                             ,             col3
                             ,             col4
                             ,             col5
                             ,             col6
                             ,             col7
                             ,             col8
                             )     AS rnum
         FROM     str
    )
    SELECT     col1
    ,     col2
    ,     col3
    ,     col4
    ,     col5
    ,     col6
    ,     col7
    ,     col8
    ,     col9
    ,     col10
    FROM     got_rnum
    WHERE     rnum     = 1
    ;
    

    With the sample data that you posted both queries produce the same results.
    With other data, both queries will produce different results.

Maybe you are looking for