Need a help with this query max

Select SEARCH_ID, SEARCH_KEYWORD, ASSET_TYPE, COUNT of RELEVANCY_TABLE

where SEARCH_KEYWORD = 'search_keyword '.

and ASSET_TYPE is not null

558search_keyword3Office
559search_keyword7Table

In fact, I have to get the asset_type which the count is the maximum. In this case, it should be "table". Any help?

adfSonal wrote:

Is there another way? I have to write this query in Java. So, I prefer avoiding rank or such functions.

I will not get the desired result using simply select, where, max, rownum clauses?

What do you mean by "I must write this query in Java? Means of the query will be run against a database of Oracle, correct?

Any means using ROWNUM

Select *.

de)

Select search_id

search_keyword

County

asset_type

of relevancy_table

where search_keyword = 'search_keyword '.

and asset_type is not null

Order

by count desc

)

where rownum = 1

Tags: Database

Similar Questions

  • Dialog box that says ' Creative Cloud Installer wants to make changes. Type your password for this purpose"- I type my password for Adobe ID (creative cloud), but it will not accept it. who should I go for help with this query?

    Dialog box that says ' Creative Cloud Installer wants to make changes. Type your password for this purpose"- I type my password for Adobe ID (creative cloud), but it will not accept it. who should I go for help with this query?

    It does not ask the cloud your computer admin password password!

  • Help with this query

    Hello

    I have a table with 3 columns, region, country, requested. Requested column is filled with 2 values only or (B) so I have to get a count (*) for A and count (*) b.

    The output should be in the following format:

    Countries in the region requested by A requested by B
    Europe Switzerland 100 120
    Asia, Singapore 300 400

    I tried to create 2 views:
    create view v_a as
    (SELECT REGION,
        COUNTRY,
        COUNT(*) A_CNT
      FROM dummy  WHERE requested ='A'
      GROUP BY (REGION, COUNTRY)
      );
    
    create view v_b as
    
    (SELECT REGION,
        COUNTRY,
        COUNT(*) B_CNT
      FROM dummy  WHERE requested ='B'
      GROUP BY (REGION, COUNTRY)
      );
    and then the select statemet did
    select * from (select v_a.region,v_a.country,v_a.a_cnt,v_b.b_cnt from v_a,v_b where v_a.country=v_b.country;
    The output not as expected. Can someone fix the code?

    Why don't you just...

    select REGION, COUNTRY, count(case when requested ='A' then 1 END)as Requested_by_A , count(case when requested ='B' then 1 END) as Requested_by_B
    from
    
    where requested in ('A','B')
    group by REGION, COUNTRY
    

    HTH

    Thank you...

  • need help for this query

    Hi gurus

    need help with this query,

    I want to display the records in the table emp
    SQL> Select Deptno,sal,sal/SUMSAL Percent,rn
      2  From  ( Select emp.*,Sum(Sal) Over() "SUMSAL",Row_number() Over(Order by sal Desc) rn
      3   From emp
      4        )
      5  /
    
          EMPNO     DEPTNO        SAL    PERCENT         RN
    --------- ---------- ---------- ---------- ----------
         7839         10       5000 .172265289          1
         7902         20       3000 .103359173          2
         7788         20       3000 .103359173          3
         7566         20       2975 .102497847          4
         7698         30       2850 .098191214          5
         7782         10       2450 .084409991          6
         7499         30       1600 .055124892          7
         7844         30       1500 .051679587          8
         7934         10       1300 .044788975          9
         7521         30       1250 .043066322         10
         7654         30       1250 .043066322         11
         7876         20       1100 .037898363         12
         7900         30        950 .032730405         13
         7369         20        800 .027562446         14
    
    14 rows selected.
                   
     
    I want just the records
          EMPNO     DEPTNO        SAL    PERCENT         RN
    ---------- ---------- ---------- ---------- ----------
          7839         10       5000 .172265289          1
          7902         20       3000 .103359173          2
          7788         20       3000 .103359173          3
          7566         20       2975 .102497847          4
          7698         30       2850 .098191214          5
    with sum (Percent) of remaing records.....
        Others                          .420327304  
    Thank you

    Published by: SeenuGuddu on February 27, 2011 03:39
    with a as
    (
    Select
    Empno, Deptno ,sal, sal/SUMSAL Percent,
    case when rn<=5 then rn else null end rnm
    From  (Select emp.*, Sum(Sal) Over() "SUMSAL",
    Row_number() Over(Order by sal Desc) rn
    From emp)
    )
    select
    case when max(rnm) is not null then to_char(max(empno)) else 'Others:' end empno,
    case when max(rnm) is not null then max(deptno) else null end deptno,
    case when max(rnm) is not null then max(sal) else null end sal,
    to_char(sum(percent), '90.99') percent,
    max(rnm) rn
    from a
    group by rnm order by rnm
    
    EMPNO                                    DEPTNO                 SAL                    PERCENT RN
    ---------------------------------------- ---------------------- ---------------------- ------- ----------------------
    7839                                     10                     5000                     0.17  1
    7902                                     20                     3000                     0.10  2
    7788                                     20                     3000                     0.10  3
    7566                                     20                     2975                     0.10  4
    7698                                     30                     2850                     0.10  5
    Others:                                                                                  0.42                         
    
    6 rows selected
    
  • Need help with a query result

    Oracle Version: 11.2.0.2.0

    I need assistance with the output of the query. Here is the table.

    With Tbl_Nm as

    (

    Select 'ABC1' SYSTEM_ID, REGION 'US', 'CHI' SUB_REGION 4000 BALANCE, to_date('1-JUN-2012 10:45:00 am', 'dd-mon-yyyy hh:mi:ss am') LAST_UPD_TIME, 'A' FLAG of union double all the

    Select 'PQR2', 'UK', 'LN', 2000, To_Date('1-JUL-2012 10:46:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select 'ABC1', 'IND","MAMA", 3500, To_Date('1-AUG-2012 11:47:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "LMN3", "US", "NJ", 2500, To_Date('1-SEP-2012 09:49:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "PQR2", "UK", "MC", 2600, To_Date('1-OCT-2012 04:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select 'ABC1', 'US', 'NY', 3200, To_Date('1-OCT-2012 06:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select "LMN3", "UK", "BT", 2400, To_Date('1-NOV-2012 07:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' From Dual

    )

    Select * from tbl_nm

    I need the output below.

    PQR2 UK MC 2600 1 OCTOBER 2012 04:45

    ABC1 US NY 3500 October 1, 2012 06:45

    LMN3 UK BT 2500 November 1, 2012 07:45

    The need the disc according to this system_id flagged as "A". But if the last disc of 'd' then it must show that the amount, but the file should be displayed in 'A '.

    I've tried a few and got stuck. Help, please. Not able to get a balance '.

    This question is a bit similar to needing help with a query result

    With Tbl_Nm as

    (

    Select 'ABC1' System_Id, region 'US', 'CHI' Sub_Region, 4000 balance, To_Date('1-JUN-2012 10:45:00 am', 'dd-mon-yyyy hh:mi:ss am') Last_Upd_Time, 'A' flag of double Union All

    Select 'PQR2', 'UK', 'LN', 2000, To_Date('1-JUL-2012 10:46:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select 'ABC1', 'IND","MAMA", 3500, To_Date('1-AUG-2012 11:47:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "LMN3", "US", "NJ", 2500, To_Date('1-SEP-2012 09:49:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "PQR2", "UK", "MC", 2600, To_Date('1-OCT-2012 04:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select 'ABC1', 'US', 'NY', 3200, To_Date('1-OCT-2012 06:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select "LMN3", "UK", "BT", 2400, To_Date('1-NOV-2012 07:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' From Dual

    )

    Select System_Id, region, Sub_Region, Balance, Last_Upd_Time of Tbl_Nm T1

    where t1. Last_Upd_Time = (select max (Last_Upd_Time) in the Tbl_Nm T2 where T1.) SYSTEM_ID = T2. SYSTEM_ID)

    So maybe you'd then

    ORDER BY DECODE(flag,'D',9,1) ASC...

    to get the Ds at the end of the list.

    or

    ORDER BY CASE WHAT flag = has ' (your other filters) AND then 9 or 1 end CSA,...

    HTH

  • [Error number: 0x8024400A] Need help with this error... I reinstalled XP SP1 and I can't get an auto update that's simple to install, just get this error every time

    [Error number: 0x8024400A] Need help with this error... I reinstalled XP SP1 and I can't get an automatic update that's simple to install, just get this error at each time HHHHEEEELLLPPPPP! Thank you

    I had the same problem.  But finally found a solution.  If your listing is similar to mine, then keep.  XP Media Center Edition 2005 (sp2).  AMD Athlon 64 x 2 Dual-Core, HP a1630n desktop computer.

    Go to the HP website, search for sp37394-XP sp3 Upgrade utility Microsoft for systems equipped with AMD processors.

    I had the same 0 x 80240036, 0x8024400a error, but realize my problem was really get manually downloaded sp3 and installed without continue loop crashing and not error messages.

  • Accidentally, I bought the Mac in December and contacted support which helped me to get the right version installed, but now the PC version is not in my account downloads and I need to add it to a new computer. I don't know how to get help with this.

    Accidentally, I bought the Mac in December and contacted support which helped me to get the right version installed, but now the PC version is not in my account downloads and I need to add it to a new computer. I don't know how to get help with this. I don't remember how I got the PC version, I think I have access to my computer remotely and she sent, but I can't find any record of it.

    Since this is an open forum, not Adobe support... you must contact Adobe personnel to help
    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)

    Creative cloud support (all creative cloud customer service problems)
    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

  • Is there a default value for the color management in PSE10? Beautiful photos from iPhoto, but blur with elements. I need help with this before as I consider that the upgrade to PSE13 and beyond.

    Is there a default value for the color management in PSE10? Beautiful photos from iPhoto, but blur with elements. I need help with this before as I consider that the upgrade to PSE13 and beyond.

    Printing which forms an angle seems ok, but one that is horizontally seems faded, incomplete.

    I was wondering if I saved a layer somewhere and set it as a default value.

    If you group the layers, you will be left with a single layer, thus spreading your concern.

    Suggest that you do the following:

    1. Make sure you have the latest drivers for your printers
    2. Reset the default preferences.

    Hold the Alt, Ctrl + Shift keys when you click the icon to open the items. When asked if you want to delete the settings file, say Yes.

    Items nearby and let regenerate the file.

  • need help with the query, thx

    Hello
    I need a little help with the query I have to write;
    the table has 4 columns:
    col1               col2         col3       col4
    emp_name     empl_id    salary      year
    
    content of data:
    
    col1               col2         col3       col4
    smith             12           1200      1999
    smith             12           1340      2000
    smith             12           1500      2001
    jones             13           1550      1999 
    jones             13           1600      2000
    aron              14           1200      2002
    what I am asking is the following result: salary according to the latest available year
    i.e.
    smith         12         1500        2001
    jones         13         1600        2000
    aron          14         1200        2002
    ID appreciate some guidance on how to achieve
    Thank you
    Rgds
    select *from
    (select col1, col2,col3, col4,row_number() over(partition by col1 order by col4 desc)  rn  from 
    ) where rn=1
    
  • Need help with this gallery of xml!

    I have build a gallery but its very simple... There are pictures of the xml file.

    I have attached all the zip files.

    I just want two things if anyone can help.

    first of all when I press the next button, he's going to the next image, but without effect. It just displays the following image... I want to incorporate the effect of dragging when the image is changed to another.

    and secondly, I want to use the AutoPlay feature.

    Once swf starts images came one by one with a vertical drop of a few seconds.

    Thanks in advance... I really need help with this..!

    For the look of sliding effect using the actionscript class Tween.  Allows you to create motion tweens using the code.  The example below will be tween property _x of the instance named anObject from 0 to 300 in 3 seconds...

    import classes before using

    Import mx.transitions.Tween;
    Import mx.transitions.easing.Regular;

    TW var = new Tween (anObject, "_x", Regular.easeIn, 0, 300, 3, true);

    To implement an enforcement function auto you need to import all the images first, in the order, then you will need to use form any controlled timer, such as setInterval (with clearInterval not to need) in order to have things turn on automatically by some part-time

  • Help with the query to create hourly statistics

    Hello!

    I have an array of jobs. Each task has a start_date and a column end_date. end_date can be null if the job is still running.

    I need to create a query to display the number of jobs running for all hours during the last two weeks.

    A job can run for more than an hour.


    I tried to define what it means for a job during an interval:


    Job.Start_date < = Interval.end AND Job.Finish_date > = Interval.start


    Can help you with this query?


    Thank you!

    Mihai


    Hi, Mihai,

    User810719-Oracle wrote:

    Hello!

    I have an array of jobs. Each task has a start_date and a column end_date. end_date can be null if the job is still running.

    I need to create a query to display the number of jobs running for all hours during the last two weeks.

    A job can run for more than an hour.

    I tried to define what it means for a job during an interval:

    Job.Start_date <= interval.end="" and="" job.finish_date="">= Interval.start...

    You gave essentially the solution yourself.  You just need to outside join your jobs table to a table (or, in the example below, a result set that acts like a table) containing 1 row for each interval.  You can use NVL to equate finish_dates with an effective DATE NULL, so they will be counted:

    WITH intervals AS

    (

    SELECT TRUNC (SYSDATE, 'HH') - ((LEVEL-1)/24) AS interval_start

    , TRUNC (SYSDATE, 'HH') - ((LEVEL-2)/24) AS interval_end

    OF the double

    CONNECT BY LEVEL<= 14="" *="">

    )

    SELECT i.interval_start

    EARL of (j.start_date) AS jobs_running

    Intervals I have

    LEFT OUTER JOIN jobs j WE j.start_date<=>

    AND NVL (j.finish_date

    i.interval_end

    ) > = i.interval_start

    ;

    If you would care to post a small example of data (CREATE TABLE and INSERT statements) and the results desired from this data, I was able to test this.

    Simplify the problem for display.  Do what you are interested only for the past 6 hours, not the last 2 weeks.  We will find a solution that can easily adapt to any number or intervals.

  • help with this thread using oracle 7.3

    Dear expert;

    On this thread, I am using

    Help with this

    but I'll need help more with additional information in this regard. see examples of data below

    Hello experts.

    I use oracle 7.3. Therefore, I have the sample data below

    create the table table_one

    (

    req_week varchar (1000).

    Username varchar (1000).

    sale number (30),

    place varchar (1000).

    break_sales number (30)

    );

    insert into table_one values ("week 1", 'John', 100, "NY", 2 ").

    insert into table_one values (' week 1', 'Chris', 20, "TX", 3 ')

    insert into table_one values ("week 1", "Melissa", 80, 'GOES', 4 ')

    insert into table_one values (' week 2', 'Katy', 40 'SC', 1 ")

    insert into table_one values (' week 2', 'Angle', 10, 'NC', 2 ')

    insert into table_one values (' week 2', "Vick", 30, 'CA', 3 ')

    insert into table_one values (' week 3', 'Zack', 60 'CA', 1 ")

    insert into table_one values (' week 3', 'Deb', 60 'NM', 2 ')

    insert into table_one values (' week 3', 'Antoine,"60,"TX", 3 ')

    necessary results

    I need the top 2 sales in a place a week

    expected results

    req_week username place sales

    Week1 John 100 NY

    Week1 Melissa 80'S

    Semaine2 Katy 40 SC

    Semaine2 Vick 30 CA

    Semaine3 Zack 60 TX

    Semaine3 Deb 60 NM

    Note, in this particular case, if there is equality in sales, then use the break_sales column as a case. The break_sales was never a tie... it is so far the query and it does not work as expected

    SELECT    d.req_week, d.username, d.sales, d.place
    FROM      nikeus_report.dbo.table_one  d
    ,        nikeus_report.dbo.table_one  o
    WHERE    d.req_week  = o.req_week
    AND      d.sales    <=  o.sales   
    GROUP BY  d.req_week, d.username, d.sales, d.place
    HAVING    COUNT (*)  <= 2         
    ;
    
    

    Any help is appreciated. Thank you

    Hello

    It seems that your existing query is very good, he's going; Just add the conditions for breaking in the WHERE clause:

    SELECT d.req_week

    d.username

    d.sales

    d.place

    FROM table_one d

    table_one o

    WHERE d.req_week = o.req_week

    AND (d.sales< >

    OR (d.sales = o.sales

    AND d.break_sales > = o.break_sales

    )

    )

    GROUP BY d.req_week

    d.username

    d.sales

    d.place

    HAVING COUNT (*)<=>

    ORDER BY d.req_week

    COUNT (*)

    ;

    Thanks for posting the CREATE TABLE and INSERT statements; that really helps.

  • Installation update for creative cloud can never exceed 2%, which means that I cannot have access to Premiere Pro. Can anyone help with this?

    Installation update for creative cloud can never exceed 2%, which means that I cannot have access to Premiere Pro. Can anyone help with this? I need urgent access to Premiere Pro, so I can return videos to my clients.

    Check your (win) Task Manager or activity (mac) for a suspended adobe monitor helps the process that you can complete.

  • I had to update my windows computer and you can no longer open Photoshop cs2.  trying to find help with this new system is not easy to use to put it kindly.  I downloaded the program and don't have the available key.  I tried to sign in but where.

    I had to update my windows computer and you can no longer open Photoshop cs2.  trying to find help with this new system is not easy to use to put it kindly.  I downloaded the program and don't have the available key.  I tried to sign in but where.

    For Photoshop CS2 activation has been reprocessed, so your original drive and the serial number does not work.

    As an owner of CS2, Adobe has a copy without activation and serial number, to which you are entitled.

    The serial number is to the right of the download link for Windows. You'll need this one, not your old number.

    Get them here: download Acrobat 7 and CS2 products

  • Help with the query to select only one record from the result set in double

    Hello

    Please help with the query. Version of Oracle database we use is 10g R2.

    I have a vision that is duplicated IDS, but they are used across the different functions. See below examples of data. Please help me with a query to select only one record (based on ID regardless of the area) from the bottom of the result set of duplicate records. For what is the point of view is there unique records, given the combination of the fields ID, Org, DF, dry, Sub-Sec

    ID
    Org
    DF
    Sec Sub-Sec

    (163)CQCPDMCPDMHD(163)PCENGENGENG(163)CQASICASICIS8888TSTACTACTAC(163)TSHEHESW6789CQINFOINFOFOS6789PCSECSYSSECSYSINFO16789TSSECSYSSECSYSINFO29009PCBMSBMSBMS1

    My result set must eliminate the duplicate identifiers regardless of whoever we choose of the result set. (I mean without distinction Org, DF, s, Sub-s). My expected result set should be.

    ID
    DSB

    DF
    SEC
    Sub-Sec
    (163)CQCPDMCPDMHD8888TSTACTACTAC6789CQINFOINFOFOS9009PCBMSBMSBMS1


    Thank you

    Orton

    Hello

    This sounds like a job for ROW_NUMBER:

    WITH got_r_num AS

    (

    SELECT id, DSB, df, s, sub_sec org

    ROW_NUMBER () OVER (PARTITION BY ID.

    ORDER BY org

    ) AS r_num

    OF view_x

    )

    SELECT id, DSB, df, sub_sec s,

    OF got_r_num

    WHERE r_num = 1

    ;

    He is a Top - N query example, where you choose the elements of N (N = 1 in this case) from the top of an ordered list.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and INSERT, only relevant columns instructions) to your sample data and the results desired from these data.  (I know that you said that you were a view selection.  Just for this thread, pretending it is a picture and post simple CREATE TABLE and INSERT statements to simulate your point of view).
    Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places.  (I didn't quite understand the explanation above.  I don't know why you want to

    ID ORG DF DRY SUB_SEC

    --      ---     --      ---     -------

    1234 CQ DPRK DPRK HD

    and is not

    1234 IS CQ ASIC, ASIC

    or

    TS 1234 IT IT SW

    or

    1234 CQ ASIC ASIC HD

    )
    If you change the query at all, post your modified version.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

Maybe you are looking for