Query to display one row per group based on highest value

I have the following table and I want to be able to create a query that displays only the highest number based on a group. (see below)
Acode
aname
anumber
a
Jim
40
a
Jim
23
a
Jim
12
b
Sal
42
b
Sal
12
b
Sal
3
Acode
aname
anumber
a
Jim
40
b
Sal
42

Multiple ways
using aggregation
SELECT Acode,aname,MAX(anumber) AS anumber
FROM table
GROUP BY Acode,aname
using subquery
SELECT Acode,aname,anumber
FROM table t
WHERE NOT EXISTS (
SELECT 1
FROM table
WHERE Acode = t.Acode
AND aname = t.aname
AND anumber > t.anumber
using analytical function
SELECT Acode,aname,anumber
FROM
SELECT *,ROW_NUMBER() OVER (PARTITION BY Acode, aname ORDER BY anumber DESC) AS Rn
FROM table
)t
WHERE Rn = 1
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • Query to split one row to multiple based on date range

    Hi,
    I need to split single row into multple based on date range defined in a column, start_dt and end_dt
    I have a data
    ID      From date             End_dt                measure
    1        2013-12-01         2013-12-03            1
    1        2013-12-04         2013-12-06            2
    2        2013-12-01         2013-12-02            11
    3        2013-12-03         2013-12-04          22
    I required output as
    ID      Date                      measure
    1        2013-12-01              1
    1        2013-12-02              1
    1        2013-12-03              1
    1        2013-12-04              2
    1        2013-12-05              2
    1        2013-12-06              2
    2        2013-12-01             11
    2        2013-12-02             11
    3        2013-12-03             22
    3        2013-12-04            22
    Please provide me sq, query for the same
    Amit
    Please mark as answer if helpful
    http://fascinatingsql.wordpress.com/

    Have a calendar table for example and then probably using UNION ALL from date  and stat date JOIN the Calendar table
    SELECT ID,From date  FROM tbl
    union all
    SELECT ID,End_dt FROM tbl
    with tmp(plant_date) as
       select cast('20130101' as datetime)
       union all
       select plant_date + 1
         from tmp
        where plant_date < '20131231'
    select*
      from  tmp
    option (maxrecursion 0)
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Returning one row per group

    I apologize if this is a duplicate of some other post, but I'm not finding this exact scenario.
    Assume that I have a table that looks like this:
    select * from PROD_TABLE
    PROD DESCRIPTION
    1234 CANDLES
    1234 CANDLE
    1235 BRAKE PADS
    1235 BRAKE PAD
    (Yes, I know, I know, but it's for a POC, so dirty data will be cleaned up later.)
    What I'd like to do is create a select statement that returns two rows from this table, one row for Prod 1234, one row for Prod 1235, and I DON'T CARE which description is returned for the corresponding Prod. For the POC, it's just not important which one is returned.
    How can I craft the select statement?

    try this
    SQL> with t as (select 1234 prod, 'CANDLES' dec from dual union all
      2  select 1234 ,'CANDLE' dec from dual union all
      3  select 1235 ,'BRAKE PADS' dec from dual union all
      4  select 1235 ,'BRAKE PAD' dec from dual)
      5  SELECT prod, DEC
      6    FROM ( SELECT a.*
      7                , ROW_NUMBER ( ) OVER ( PARTITION BY prod ORDER BY prod ) rn
      8            FROM t a )
      9   WHERE rn = 1
    10  /
          PROD DEC
          1234 CANDLES
          1235 BRAKE PADS
    SQL>

  • How to pivot horizontally Author names, and group by Book title. One row per book with multiple authors

    I have 3 tables - Book, Author, BookAuthorReference
    A book can have multiple authors, and when I do straight query I get multiple rows per book
    SELECT <columns>
    FROM Book b, Author a, BookAuthorReference ba
    where ba.BookId = b.BookId and
    ba.AuthorId = a.AuthorId
    I want to get the results as ONE row per book, and Authors separated by commas, like:
    SQL 2008 internals book    Paul Randal, Kimberly Tripp, Jonathan K, Joe Sack...something like this
    Thank you in advance

    This can by done by straying into XML land. The syntax is anything but intuitive, but it works. And moreover, it is guaranteed to work.
    SELECT b.Title, substring(a.Authors, 1, len(a.Authors) - 1) AS Authors
    FROM   Books b
    CROSS  APPLY (SELECT a.Author + ','
                  FROM   BookAuthorReference ba
                  JOIN   Authors a ON a.AuthorID = ba.AuthorID
                  WHERE  ba.BookID = a.BookID
                  ORDER  BY ba.AuthorNo
                  FOR XML PATH('')) AS a(Authors)
    Erland Sommarskog, SQL Server MVP, [email protected]

  • OCI - Array-Fetch vs. One-row-per-fetch

    Hello guys,
    i have a question about the OCI and the possibilities about fetches.
    Is it possible to get only one row per fetch without setting the array size to 1?
    I have a third party application that shows this behaviour which i have rebuild in sqlplus.
    SQL> create table mytest (a number);
    SQL> begin
      2  for i in 1 .. 1500 loop
      3  insert into mytest values (i);
      4      end loop;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL> commit;
    Commit complete.
    SQL> set autotrace traceonly;
    -- Now with the default array size of 15 with sqlplus
    SQL> select * from mytest;
         118  consistent gets
         101  SQL*Net roundtrips to/from client
         1500  rows processed
    -- Now with a bigger array size (150)
    SQL> set arraysize 150
    SQL> select * from mytest;
         17  consistent gets
         11  SQL*Net roundtrips to/from client
         1500  rows processed
    -- Now the behaviour of the third party application
    SQL> set arraysize 1
    SQL> select * from mytest;
         757  consistent gets
         751  SQL*Net roundtrips to/from client
         1500  rows processed
    SQL> set arraysize 2
    SQL> select * from mytest;
         757  consistent gets
         751  SQL*Net roundtrips to/from client
         1500  rows processedThe third party application is a c program and i can not take a look at the code.
    So as you can see the consistent gets are the same with arraysize 1 and 2. The sql statement which is executed of the c-program is returning a huge amount of data and it seems like it is run with arraysize 1 or 2 or it is executing a different OCI call.
    So now is my question:
    Which methods does the OCI interface provide to recieve (fetch) data?
    - Is it only array fetching (like sqlplus do) or is it possible to return only one row per fetch with a specific call.
    I can speed up the query by setting the bigger array-size in sqlplus .. but i want to point the programers to the possibilities with the OCI.
    Thanks and Regards
    Stefan

    The following call in OCI can be used to control the fetched rows
    MAX_PREFETCH_ROWS is number of rows you want to fetch in one round trip.
    (void) OCIAttrSet((dvoid *)DBctx->stmthp, (ub4) OCI_HTYPE_STMT,
    (dvoid *)&MAX_PREFETCH_ROWS,(ub4)sizeof(MAX_PREFETCH_ROWS),(ub4) OCI_ATTR_PREFETCH_ROWS, DBctx->errhp);

  • Disabling the display maximum rows per page

    My project include many reports with table view, displaying 100 rows.
    There is always arrows icon with the option to display maximum rows per page.
    If user click on that option the OBIEE crashed, since there are a lot of rows.
    I cannot decrese this number since all rows are required for other charts views.
    a. Is there a way to set this parameter only for the table view?
    b. Is there a way to disable this icon or not presenting it to the user?
    c. Is there global way to coonfigure the default displayed rows number (e.g. from 100 to 20)?

    unfortunately, you are limited to the SRW built-ins in Reports as far as setting object properties is concerned. I have checked this with the Metalink staff and I did get an admission out of them that this is true.
    You can set the property in the property palette, but I'm not sure that this helps you as I take it you have a condition you would like to implement. I wish I could help you further, but Reports is limited in some areas, and setting object properties programmatically is one of them.

  • Parse column with csv string into table with one row per item

    I have a table (which has less than 100 rows) - ifs_tables that has two columns: localtable and Fields. Localtable is a table name and Fields contains a subset of columns from that table. Fields is a comma delimited list:  'Fname,Lname'. It looks like
    this:
    localtable         fields
    =========  =============
    customertable   fname,lname
    accounttable     type,accountnumber
    Want to end up with a new table that has one row per column. It should look like this:
    TableName             ColumnName
    ============ ==========
    CustomerTable        Fname
    CustomerTable        Lname
    AccountTable          Type
    AccountTable          AccountNumber
    Tried this code but have two issues (1) My query using the Splitfields functions gets "Subquery returned more than 1 value" (2) some of my Fields has hundreds of collumns in the commas delimited list. It will returns "Msg 530, Level 16, State
    1, Line 8. The statement terminated. The maximum recursion 100 has been exhausted before statement completion.maxrecursion greater than 100." Tried adding OPTION (maxrecursion 0) in the Split function on the SELECT statment that calls the CTE, but
    the syntax is not correct.
    Can someone help me to get this sorted out? Thanks
    DROP FUNCTION [dbo].[SplitFields]
    go
    CREATE FUNCTION [dbo].[SplitFields]
    @String NVARCHAR(4000),
    @Delimiter NCHAR(1)
    RETURNS TABLE
    AS
    RETURN
    WITH Split(stpos,endpos)
    AS(
    SELECT 0 AS stpos, CHARINDEX(@Delimiter,@String) AS endpos
    UNION ALL
    SELECT endpos+1, CHARINDEX(@Delimiter,@String,endpos+1)
    FROM Split
    WHERE endpos > 0
    SELECT 'Id' = ROW_NUMBER() OVER (ORDER BY (SELECT 1)),
    'Data' = SUBSTRING(@String,stpos,COALESCE(NULLIF(endpos,0),LEN(@String)+1)-stpos)
    FROM Split --OPTION ( maxrecursion 0);
    GO
    IF OBJECT_ID('tempdb..#ifs_tables') IS NOT NULL DROP TABLE #ifs_tables
    SELECT *
    INTO #ifs_tables
    FROM (
    SELECT 'CustomerTable' , 'Lname,Fname' UNION ALL
    SELECT 'AccountTable' , 'Type,AccountNumber'
    ) d (dLocalTable,dFields)
    IF OBJECT_ID('tempdb..#tempFieldsCheck') IS NOT NULL DROP TABLE #tempFieldsCheck
    SELECT * INTO #tempFieldsCheck
    FROM
    ( --SELECT dLocaltable, dFields from #ifs_tables
    SELECT dLocaltable, (SELECT [Data] FROM dbo.SplitFields(dFields, ',') ) from #ifs_tables
    ) t (tLocalTable, tfields) -- as Data FROM #ifs_tables
    SELECT * FROM #tempFieldsCheck

    Try this
    DECLARE @DemoTable table
    localtable char(100),
    fields varchar(200)
    INSERT INTO @DemoTable values('customertable','fname,lname')
    INSERT INTO @DemoTable values('accounttable','type,accountnumber')
    select * from @DemoTable
    SELECT A.localtable ,
    Split.a.value('.', 'VARCHAR(100)') AS Dept
    FROM (SELECT localtable,
    CAST ('<M>' + REPLACE(fields, ',', '</M><M>') + '</M>' AS XML) AS String
    FROM @DemoTable) AS A CROSS APPLY String.nodes ('/M') AS Split(a);
    Refer:-https://sqlpowershell.wordpress.com/2015/01/09/sql-split-delimited-columns-using-xml-or-udf-function/
    CREATE FUNCTION ParseValues
    (@String varchar(8000), @Delimiter varchar(10) )
    RETURNS @RESULTS TABLE (ID int identity(1,1), Val varchar(8000))
    AS
    BEGIN
    DECLARE @Value varchar(100)
    WHILE @String is not null
    BEGIN
    SELECT @Value=CASE WHEN PATINDEX('%'+@Delimiter+'%',@String) >0 THEN LEFT(@String,PATINDEX('%'+@Delimiter+'%',@String)-1) ELSE @String END, @String=CASE WHEN PATINDEX('%'+@Delimiter+'%',@String) >0 THEN SUBSTRING(@String,PATINDEX('%'+@Delimiter+'%',@String)+LEN(@Delimiter),LEN(@String)) ELSE NULL END
    INSERT INTO @RESULTS (Val)
    SELECT @Value
    END
    RETURN
    END
    SELECT localtable ,f.Val
    FROM @DemoTable t
    CROSS APPLY dbo.ParseValues(t.fields,',')f
    --Prashanth

  • Hacking application id equals() to allow more than one row per "primary key"

    I have a read only entity whose primary key is not the real primary key
    on the underlying table. The result is that I get more than one row per
    "primary key". This is what I want. However KODO will not allow me do
    it, because I am storing the collection in a HashSet() and the equals()
    method on the application id object ensures that this set contains no
    duplicates (as defined by the application id). At least thats how it
    seems to behave.
    So, I have hacked the equals() method to do this:
    public boolean equals (Object ob)
    if (this == ob)
    return true;
    // Doing this because we expect more than one row from
    // REF_CODES for the same domain/shortCode combination.
    // This is ok to do (I guess?) as long as we are only
    // doing selects using this class.
    return false;
    Will this hack have any side effects? Is there another option? Like
    using a list collection? Is so, which collections are supported?
    Thanks,
    Mike.

    The "primary key" I am using it already a compound key of two columns.
    The real key on the underlying table is a three column key. But the
    problem is that the table represents two different application level
    entities. I could deal with it when I was hand-writing SQL (I could do
    a distinct for example) but now I am relying on foreign key
    relationships since I moved to JDO. Not sure what to do. Best solution
    is to rework the table, but there is a lot of legacy code (that other
    teams use and maintain) relying on this table. I guess I'll use the
    weekend for inspiration ;-)
    Steve Kim wrote:
    This sounds like a dangerous operation. Even if this works now, I
    cannot promise future compatibility... and in fact may result in bad
    data (for example in caching both at the PM and PMF level) Is there no
    other field that you can reference as part of the primary key? Primary
    Keys can be multi columned (e.g. last_name, soc_sec_number)
    Mike Hogan wrote:
    I have a read only entity whose primary key is not the real primary
    key on the underlying table. The result is that I get more than one
    row per "primary key". This is what I want. However KODO will not
    allow me do it, because I am storing the collection in a HashSet() and
    the equals() method on the application id object ensures that this set
    contains no duplicates (as defined by the application id). At least
    thats how it seems to behave.
    So, I have hacked the equals() method to do this:
    public boolean equals (Object ob)
    if (this == ob)
    return true;
    // Doing this because we expect more than one row from
    // REF_CODES for the same domain/shortCode combination.
    // This is ok to do (I guess?) as long as we are only
    // doing selects using this class.
    return false;
    Will this hack have any side effects? Is there another option? Like
    using a list collection? Is so, which collections are supported?
    Thanks,
    Mike.

  • Why does firefox display one word per sentence

    firefox displays one word per sentence reading comments on www.zerohedge.com firefox is the only browser that does this Firefox has always done this reformat of the coments since day one why??

    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    *https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
    *Use a compressed image type like PNG or JPG to save the screenshot
    *Make sure that you do not exceed the maximum size of 1 MB
    You can try these steps in case of issues with web pages:
    You can reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and remove cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > "Use custom settings for history" > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Input ready query and display only rows

    I am trying to replicate scenario which is equivalent to creating manual layout in SEM-BPS with settings for layout category - Key Figures in Data columns, and rows defined individually.  In this version it is possible to restrict certain rows as comparision only.
    How can I acheive this using Input ready query? In my query I have created a strucure for Planning Items, but I am not able to show certain planning item selections as display only.
    Any thoughts?

    Hello Gregor,
    Thanks for you answer.
    I already have two structures as mentioned by you.
    Can you please let me know what exactly you meant by set the input flag on the cell level? What settings I have to change to set the flag, do I have to use any formula?  In my example I have three rows for Planning item row structure and I want only one row to be selected as display only row. 
    Regards,
    Sachin

  • Display one row only

    This query
    SELECT
    SCRATTR_ATTR_CODE
    from scrattr_TEST,scbcrse_TEST
    where
    SUBSTR(scbcrse_subj_code,1,3)  = SUBSTR(scrattr_subj_code,1,3)
    and SUBSTR(scbcrse_crse_numb,1,4)  = SUBSTR(scrattr_crse_numb,1,4)Returns this
    SCRATTR_ATTR_CODE
    A
    INS
    MCSR How I can make to return someting like A INS MCSR in one row there is a row for every code
    hERE is some code to create the tables and insert the data
    CREATE TABLE SCRATTR_test
      SCRATTR_SUBJ_CODE      VARCHAR2(4 CHAR)       NOT NULL,
      SCRATTR_CRSE_NUMB      VARCHAR2(5 CHAR)       NOT NULL,
      SCRATTR_EFF_TERM       VARCHAR2(6 CHAR)       NOT NULL,
      SCRATTR_ATTR_CODE      VARCHAR2(4 CHAR)
      CREATE TABLE SCBCRSE_test
      SCBCRSE_SUBJ_CODE              VARCHAR2(4 CHAR) NOT NULL,
      SCBCRSE_CRSE_NUMB              VARCHAR2(5 CHAR) NOT NULL,
      SCBCRSE_EFF_TERM               VARCHAR2(6 CHAR)
    insert into SCRATTR_test (SCRATTR_SUBJ_CODE,SCRATTR_CRSE_NUMB,SCRATTR_EFF_TERM,SCRATTR_ATTR_CODE) select 'BIO','2210','201320',' A' from dual;
    insert into SCRATTR_test (SCRATTR_SUBJ_CODE,SCRATTR_CRSE_NUMB,SCRATTR_EFF_TERM,SCRATTR_ATTR_CODE) select 'BIO','2210','201320','INS' from dual;
    insert into SCRATTR_test (SCRATTR_SUBJ_CODE,SCRATTR_CRSE_NUMB,SCRATTR_EFF_TERM,SCRATTR_ATTR_CODE) select 'BIO','2210','201320','MCSR' from dual;
    COMMIT;
    INSERT INTO  SCBCRSE_test(SCBCRSE_SUBJ_CODE,SCBCRSE_CRSE_NUMB,SCBCRSE_EFF_TERM) SELECT  'BIOL','2210','201320' FROM DUAL
    COMMIT; Thank you

    Based on your testcase, on 11.2 you could just:
    SQL> select listagg(a.SCRATTR_ATTR_CODE, ' ') within group (order by rownum)
      2  from   scrattr_TEST a
      3  ,      scbcrse_TEST b
      4  where  SUBSTR(b.scbcrse_subj_code,1,3)  = SUBSTR(a.scrattr_subj_code,1,3)
      5  and    SUBSTR(b.scbcrse_crse_numb,1,4)  = SUBSTR(a.scrattr_crse_numb,1,4);
    LISTAGG(A.SCRATTR_ATTR_CODE,'')WITHINGROUP(ORDERBYROWNUM)
    A INS MCSR

  • Can an Excel Report with Multivalue Custom field list report on one row per task

    I have a ECF Multi Value field (MVF) at the Task Level and have created a report.  In Excel it wants to add it as a Pivotable, which makes sense and I end up with a row for each MVF.  If a Task has 3 MV selected there are 3 rows returned.
    I want to see if it will return only one row (row per task). 
    Example of Result Required
    PTask name , MVf Value1, MVF Value2, MVF Value 3.
    Build Car             X                                    
    X
    Build Bike            X                     X
    Is it possible?  is there something in my SQL Query I can do or is there something in Excel I can configure?
    Result being Returned
    PTask name , MVf Value1, MVF Value2, MVF Value 3.
    Build Car             X                                    
    Build Car                                                    X
    Build Bike            X                    
    Build Bike                                 X
    SQL Query
    SELECT
    MSP_EpmProject_UserView.ProjectOwnerName,
    MSP_EpmProject_UserView.ProjectName,
    MSP_EpmTask_UserView.TaskName,
    MSP_EpmLookupTable.MemberFullValue AS [Item],
    Iif(MSP_EpmLookupTable.MemberFullValue LIKE 
    '%' + 'CPT' + '%','X','') AS [CPT],
    Iif(MSP_EpmLookupTable.MemberFullValue LIKE 
    '%' + 'TS' + '%','X','') AS [TS],
    Iif(MSP_EpmLookupTable.MemberFullValue LIKE 
    '%' + 'CSAs' + '%','X','') AS [CSAs],
    Iif(MSP_EpmLookupTable.MemberFullValue LIKE 
    '%' + 'EM' + '%','X','') AS [EM],
    Iif(MSP_EpmLookupTable.MemberFullValue LIKE 
    '%' + 'RS' + '%','X','') AS [RS],
    Iif(MSP_EpmLookupTable.MemberFullValue LIKE 
    '%' + 'IS' + '%','X','') AS [IS]
    FROM
    MSP_EpmProject_UserView INNER JOIN
    MSP_EpmTask_UserView ON
    MSP_EpmProject_UserView.ProjectUID = MSP_EpmTask_UserView.ProjectUID
    LEFT OUTER JOIN
    [MSPCFTASK_Service Areas_AssociationView] ON
    MSP_EpmTask_UserView.TaskUID = [MSPCFTASK_Service Areas_AssociationView].EntityUID
    LEFT OUTER JOIN
    MSP_EpmLookupTable ON
    [MSPCFTASK_Service Areas_AssociationView].LookupMemberUID = MSP_EpmLookupTable.MemberUID
    WHERE datalength(MSP_EpmLookupTable.MemberFullValue) > 0
    Andrew Payze

    Hi Andrew,
    I'm not a developer, but I found something in my documentation that could help you. This is a SQL store procedure that returns in an Excel pivot table something like below (GR_test6 being a project and values in the next column being multivalue project ECF
    values).
    SELECT proj.ProjectName,
    lt.MemberFullValue AS 'VLookupField'
    FROM dbo.MSP_EpmProject_UserView AS proj
    LEFT OUTER JOIN [dbo].[MSPCFPRJ_ProjectECF_AssociationView] AS MVassoc -- view for multi value field
    ON proj.ProjectUID = MVassoc.EntityUID
    LEFT OUTER JOIN dbo.MSP_EpmLookupTable AS lt
    ON MVassoc.LookupMemberUID = lt.MemberUID
    order by ProjectName asc
    Hope this helps.
    Guillaume Rouyre - MBA, MCP, MCTS

  • PUT QUERY RESULT ON ONE ROW INSTEAD OF MULTIPLE ONE

    Hi
    I have two tables with the column id_table1 to join them.
    My first table "table_one" contain 3 fields and one record.
    id_table1 : 1
    table1 : project1
    date_project : 2005/08/01
    My second table "table_two" contain 3 fileds and 3 records which contain the id 1 on the join column.
    id_table2 : 1
    table2 : pdf
    id_table1 : 1
    id_table2 : 2
    table2 : excel
    id_table1 : 1
    id_table2 : 3
    table2 : text
    id_table1 : 1
    If i did a simply join, the result is appear in 3 lines:
    1 project1 2005/08/01 excel
    1 project1 2005/08/01 pdf
    1 project1 2005/08/01 text
    Is this possible to have this result in one query :
    1 project1 2005/08/01 excel pdf text
    I mean to have the result in one row and a separated column for each item of the table2.
    We know how to do it with one column concatened ("excel pdf text") but not with separated column
    ("excel" "pdf" "text")
    Thanks if someone has a solution.
    Alexandre

    SQL> select e.job, d.dname from emp e, dept d where e.deptno = d.deptno;
    JOB       DNAME
    CLERK     RESEARCH
    SALESMAN  SALES
    SALESMAN  SALES
    MANAGER   RESEARCH
    SALESMAN  SALES
    MANAGER   SALES
    MANAGER   ACCOUNTING
    ANALYST   RESEARCH
    PRESIDENT ACCOUNTING
    SALESMAN  SALES
    CLERK     RESEARCH
    CLERK     SALES
    ANALYST   RESEARCH
    CLERK     ACCOUNTING
    14 rows selected.
    SQL> select e.job,
      2  max(decode(d.dname,'RESEARCH',d.dname,null)) "Research",
      3  max(decode(d.dname,'SALES',d.dname, null)) "Sales",
      4  max(decode(d.dname,'ACCOUNTING',d.dname,null)) "Accounting"
      5  from emp e, dept d where e.deptno = d.deptno
      6  group by job
      7  /
    JOB       Research       Sales          Accounting
    ANALYST   RESEARCH
    CLERK     RESEARCH       SALES          ACCOUNTING
    MANAGER   RESEARCH       SALES          ACCOUNTING
    PRESIDENT                               ACCOUNTING
    SALESMAN                 SALESRgds.

  • How can I display one of two DataTables based on criteria

    I have two DataTables. One DataTable should be displayed or the other DataTable should be displayed in the same JSP based on some criteria. I wish I could put an if statement in the JSP page but how else can I do this? Is there a JSF tag that is like an if statement?

    Hi
    Try to use rendered attribute.
    Create boolean variable in your bean ie private boolean showTab1And in jsp type
    <h:dataTable id="tab1" value="..." var="..."  rendered="#{myBean.showTab1}">
    </h:dataTable>
    <h:dataTable id="tab2" value="..." var="..."  rendered="#{!myBean.showTab1}">
    </h:dataTable>if showTab1 is true, first dataTable shows, otherwise second dataTable is shown.
    Hope it helps
    Martin
    ps. You can combine value of rendered :
    rendered="#{myBean.boolVar1 && myBean.boolVar2 && !myBean.boolvar3}"

  • OBIEE 11g: Report not displaying maximum rows per page

    I have an OBIEE report that is not displaying the maximum rows per page. When I click on the UP/DOWN arrow at the bottom of the report there is no change.

    Hi,
    Refer the below link.
    http://satyaobieesolutions.blogspot.in/2012/08/limit-row-in-table-and-graph-in-initial.html
    OR,
    https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=1198961.1
    Add the following to your instanceconfig and then restart the presentation service.
    file path
    D:\Oracle\Middleware\instances\instance1\config\OracleBIPresentationServicesComponent\coreapplication_obips1\instanceconfig.xml just add below lines
    <Views>
    <Pivot>
    <MaxCells>6500000</MaxCells>
    <MaxVisibleColumns>100</MaxVisibleColumns>
    <MaxVisiblePages>100</MaxVisiblePages>
    <MaxVisibleRows>65000</MaxVisibleRows>
    <MaxVisibleSections>25</MaxVisibleSections>
    <DefaultRowsDisplayed>500</DefaultRowsDisplayed>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDelivery>75</DefaultRowsDisplayedInDelivery>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDownload>65000</DefaultRowsDisplayedInDownload>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DisableAutoPreview>false</DisableAutoPreview>
    </Pivot>
    <Table>
    <MaxCells>6500000</MaxCells>
    <MaxVisiblePages>100</MaxVisiblePages>
    <MaxVisibleRows>65000</MaxVisibleRows>
    <MaxVisibleSections>25</MaxVisibleSections>
    <DefaultRowsDisplayed>500</DefaultRowsDisplayed>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDelivery>75</DefaultRowsDisplayedInDelivery>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDownload>65000</DefaultRowsDisplayedInDownload>
    </Table>
    </Views>
    Hope this help's
    Thanks,
    Satya

Maybe you are looking for

  • I can not change the time in activity Appointment in WebUi

    Dear Experts! I can not change the time in activity Appointment when creating: calendar -> month -> click on the day snapshot of problem: http://imglink.ru/show-image.php?id=e7a096115a6371ffab46c701f8e470ba When I create a Appointment (Activities ->

  • Shrink Log File on MS sql 2005

    Hi all, My DB has a huge logfile, with more than 100gb. The idea is to shrink it, but the good way. I was trying this way: use P01 go backup log P01 TO DISK = 'D:\P01LOG1\P01LOG1.bak' go dbcc shrinkfile (P01LOG1,250) with no_infomsgs go The problem i

  • Error Message : T.Code TBB1 for posting Treasury Transaction

    When we are posting transaction through TBB1 in Treasury and Risk Management, Error posting Message is poping up which says FAGL_LEDGER_CUST102.  Diagnosis : Ledger Group &1 is assigned to another application. Please let us know how to solve this? Th

  • Problems restoring partition after bootcamp failure

    Hi! I'm using a new MacBook Pro (Retina, 15") with OS X 10.10.2 where I tried to install Windows 8.1 with the help of the Bootcamp-assistant. Everything went well to set up the partitions and I decided to set aside 50 GB for my Windows partition. But

  • PAL & NTSC From One Project

    This discussion from the Adobe Encore (full-featured authoring program, bundled with Premiere Pro) might be helpful when one needs both PAL & NTSC from a Project: http://forums.adobe.com/thread/995779. While it comes from the Encore Forum, there are