separate and more than 2 column-max

Hi all

Need some help here. I have a table and need to display the latest revision. But the problem is, I can't use SEPARATE for the column TITLE and MAX also failed when the column is greater than 2. I'm really stuck

I try under SQL statement but failed:
SELECT the title, MAX (review), Coordinator
OF the specification
GROUP BY title, Coordinator

But if my table has only 2 column, it works:
SELECT title, MAX (review)
OF the specification
GROUP BY title

Table name: SPECIFICATION

TITLE REVIEW COORDINATOR                  
SPEC-01 a John
Michelle B SPEC-01
SPEC-01b Andrew
SPEC-01 John
SPEC-02 a Jenny
SPEC-02 B Robert



The result should be as below:

TITLE REVIEW COORDINATOR                  
SPEC-01 John
SPEC-02 B Robert

Published by: 872733 on July 18, 2011 01:14

Hello

You can use this:

with t as (
select 'SPEC-01' title, 'A' revision, 'John' coordinator from dual union all
select 'SPEC-01' title, 'B' revision, 'Michelle' coordinator from dual union all
select 'SPEC-01' title, 'C' revision, 'Andrew' coordinator from dual union all
select 'SPEC-01' title, 'D' revision, 'John' coordinator from dual union all
select 'SPEC-02' title, 'A' revision, 'Jenny' coordinator from dual union all
select 'SPEC-02' title, 'B' revision, 'Robert' coordinator from dual
)
-- end of sample data
select distinct
    title,
    first_value (revision) over (partition by title order by revision desc) revision,
    first_value (coordinator) over (partition by title order by revision desc) coordinator
from t;

TITLE   REVISION   COORDINATOR
------- ---------- ---------------
SPEC-01 D          John
SPEC-02 B          Robert

Kind regards
Sylvie

Tags: Database

Similar Questions

  • replacement selection on 2 columns and return more than 1 column lists

    Hello

    I try to build 2 other selection lists and each selection list should return more than 1 column

    2 PART_ID and PART_SPECIFICATION columns

    Now I build a select on PART_ID as list

    Select part_id d, part_id parts r;

    The result should be:

    PART_ID and PART_SPECIFICATION a PART_ID column must be the text of PART_SPECIFICATION

    The selection based on PART_SPECIFICATION list should be like

    Select d, part_id parts r part_specification;

    Now, it should be posted part_specification in PART_SPECIFICATION and part_id in PART_ID.

    This is because a user knows the part_id and the other knows only the specification

    Please help me

    Siegwin

    Hi Siegwin,

    Check your application Page 7 (copy of the 500 page) using the selection instead of plugin list, it gives all the values.

    and works very well,

    use ajax process to get the Xml data in page elements

    Here are the changes

    application process: getData

    point of application: TEMPORARY_APPLICATION_ITEM

    create a function in the html header pull_multi_value() page

    and he gave the floor to point page p7_empno on the attribute of the html form element as onchange = "pull_multi_value (this.value)"; ""

    This can help you.

    Leave.

  • Presentation of master-detail Spry insert cannot get more than two columns?

    Ive been trying to get more than two columns only experiment with spry data sets and can not with the option to «insert master/detail layout» layout

    What I am doing wrong?

    ??????

    <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
    "< html xmlns ="http://www.w3.org/1999/xhtml"" xmlns: spry = "http://ns.adobe.com/spry" > ""
    < head >
    < meta http-equiv = "Content-Type" content = text/html"; charset = utf-8 "/ >"
    < title > Untitled Document < /title >

    < script src = "SpryAssets/SpryData.js" type = "text/javascript" > < / script > "
    < script src = "SpryAssets/SpryHTMLDataSet.js" type = "text/javascript" > < / script > "
    < link href = "SpryAssets/SpryMasterDetail.css" rel = "stylesheet" type = "text/css" / > "
    < script type = "text/javascript" >
    DS1 var = new Spry.Data.HTMLDataSet ("benefitsdata.html", "bizben", {firstRowAsHeaders: false});
    < /script >
    < / head >

    < body >
    < div align = "center" >
    < div class = "MasterDetail" >
    < div spry: region = "ds1" class = "MasterContainer" >
    < div class = "MasterColumn" spry: repeat = "ds1" spry: setrow = "ds1" spry: hover = "MasterColumnHover" spry: select = "MasterColumnSelected" > {column0} < / div >
    < / div >
    < div spry: detailregion = "ds1" class = "DetailContainer" >
    < div class = "DetailColumn" > {column1} < / div >
    < div class = "DetailColumn" > {Column2} < / div >
    < div class = "DetailColumn" > {Column3} < / div >
    < / div >
    < br style = "" clear: both "/ >"
    < / div >
    < / div >
    < / body >
    < / html >

    ____________

    Spry framework all related examples are available here: http://adobe.github.com/Spry/samples/ you can take a look.

    On a sidenote, Spry has been deprecated and is no longer officially supported by Adobe: http://blogs.adobe.com/dreamweaver/2012/08/update-on-adobe-spry-framework-availability.htm l

    I would recommend that you switch to a jQuery library to your other needs.

  • Tables compressed with more than 255 columns

    Hello

    Anyone for a sql to find tables compressed with more than 255 columns.

    Thank you

    Jonu

    SELECT table_name,

    County (column_name)

    Of utc user_tab_columns

    WHERE utc.table_name IN (SELECT table_name

    From user_tables

    Compression WHERE = "ENABLED")

    HAVING Count(column_name) 255 >

    GROUP BY table_name

  • How to find the names of tables that have more than 100 columns

    Hi gurus,

    Please help me find the names of the tables that have more than 100 columns in the database.

    Below will be useful for you.

    SELECT atc.OWNER,atc.TABLE_NAME,count(*)
    FROM all_tab_columns atc
    GROUP BY  atc.OWNER,atc.TABLE_NAME
    HAVING count(atc.COLUMN_NAME) > 100
    

    Adding another point, you can use user_tab_columns, all_tab_columns, dba_tab_columns, based on your needs/access.

    Thank you
    Suri

    Published by: Suri on February 23, 2012 11:30

  • How to have more than 20 columns in a table in the form of adobe?

    I see that there is limitaion of not having more than 20 columns in my table in the form of adobe, is it possible that I can have more than 20 columns in a table in the form of adobe in landscape mode.

    Hello

    Which applies only to the Table Wizard. Once the table is placed on the page, you can add columns manually in the menu or by right-clicking a column.

    You can also use fields in a repeating subform (rather than the object of the table).

    Good luck

    Niall

  • Once I updated to Firefox 11, I can't open the pdf files. It's more the computer, snow leopard and lion and more than one Web site.

    I've updated to Firefox 11 and now I can't open the PDFs Online. This has happened on more than 1 computer, using the two OS 10.6.8 and OS 7.0 and on more than one Web site. I tried to uncheck "block pop-up windows" in preferences, but which did not help.
    When I use Safari to open the same file to pdf, they open fine. Everything worked fine with my Firefox until I did the upgrade.

    I prefer to continue to use Firefox, but I can't understand the root of the problem.

    Has anyone else had this happen as well?

    Thank you, gentlemen, to find a "solution" to this particular behavior of Firefox. It is really curious that even if the screen is blank, you can indeed save the .pdf Ghost and then open the saved file to view. What is amazing to me is that this issue does not seem to be what makes the hit parade of the problems currently experienced Mozilla. Not everyone will be willing to do a research project extended rather than leave the ship for Safari, etc..

  • New APEX listening port and more than 32K

    Hi all

    Is the problem with the recording of high values (greater than 32 k) solved with the new listener APEX 4.0?

    Thank you
    Fadi.

    Samara says:
    Is the problem with the recording of high values (greater than 32 k) solved with the new listener APEX 4.0?

    The Apex team must answer as to what is expected for Apex 4.0, but the 32 k issue is twofold:

    (a) the bridge between the web browser/server and the database should handle more than 32 K string values (IE. CLOB).

    (b) the framework of the Apex (the procedure 'accept' who gets all values when you submit a page) must manage more string of 32 k values (IE. CLOB).

    Now, the problem with one) should be easy enough to fix with the new listener to the Apex. If you want to use Microsoft IIS as a web server, see my [gateway Thoth | http://code.google.com/p/thoth-gateway/] which already supports the CLOB parameters. You'll always need to manage registration of great values through an application process (Ajax), due to problem b), which is that the framework of Apex does not use CLOB parameters in the current version.

    However, since one) can be fixed easily in the listener of the Apex, but for Oracle set in the embedded PL/SQL gateway and in mod_plsql would probably take a lot longer because it follows the (slow) the database release cycles, I don't know if the Apex team will change the frame if the feature can only be used on one of the three doors (officially supported).

    -Morten

    http://ORA-00001.blogspot.com

  • compare the permeable line data and add more than 1 column

    I have data like this

    col1 col2 col3

    1 AB XY

    UV 1 CD

    EF 2 OP

    2 GH QR

    3. I M

    4 J N

    I got kicked out like that

    Col1 Col2

    1 AB CD XY UV

    2 EF GH OP QR

    3. I J

    M 4 N

    I'm using oracle 10.2.0.4.My table is located in the remote database. Also my concatinated output is greater than 4000 bytes

    I tried the queries I can copied that did not work.

    option 1
    It gives the error ORA-22992: cannot use LOB Locators selected remote tables

    Request_id SELECT, to_clob (wm_concat (col2 | col3) as notes)
    FROM table_x
    GROUP BY col1

    option 2
    This works, but does not allow to add other columns
    WITH got_r_num AS
    (
    SELECT col1, col2
    ROW_NUMBER () OVER (PARTITION BY col1
    ORDER BY col2
    ) AS r_num
    FROM table_x
    )
    SELECT col1
    REPLACE (SYS_CONNECT_BY_PATH (col2, ',')
    , ','
    ) AS all_col2s
    OF got_r_num
    WHERE CONNECT_BY_ISLEAF = 1
    START WITH r_num = 1
    CONNECT BY r_num = r_num + 1
    AND col1 = col1 PRIOR

    Please help me

    Thank you very much

    Try this

    with t
    as
    (
    select 1 c1,'AB' c2,'XY' c3 from dual union all
    select 1,'CD','UV' from dual union all
    select 2,'EF','OP' from dual union all
    select 2,'GH','QR' from dual union all
    select 3,'I','M' from dual union all
    select 4,'J','N' from dual
    )
    select c1, ltrim(sys_connect_by_path(c2,','),',')||','||ltrim(sys_connect_by_path(c3,','),',') c2
      from (select t.*, row_number() over(partition by c1 order by 1) rno
              from t)
     where connect_by_isleaf = 1
     start with rno = 1
    connect by c1 = prior c1
       and rno = prior rno + 1
    
  • Remove the statement with subquery with more than 1 columns

    Hi all

    I want to delete the data in the kpi_logs table for which the kpi_def_id column is less than the max (timestamp). The timestamp is the date data type. I wrote below query but its throwing an error as an SQL error: ORA-00936: lack of expression.

    DELETE FROM KPI_LOGS WHERE (Select MAX (TIMESTAMP), KPI_DEF_ID of the KPI_DEF_ID KPI_LOGS GROUP);

    Hello

    user12251389 wrote:

    I want to delete the data in the kpi_logs table for which the kpi_def_id column is less than the max (timestamp). The timestamp is the date data type. I wrote below query but its throwing an error as an SQL error: ORA-00936: lack of expression.

    DELETE FROM KPI_LOGS WHERE (Select MAX (TIMESTAMP), KPI_DEF_ID of the KPI_DEF_ID KPI_LOGS GROUP);

    Whenever you have a question, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the accurate results you want from this data, so that people who want to help you can recreate the problem and test their ideas.

    If you ask about a DML operation, such as DELETE, and INSERT statements, you post should show what looks like the tables before the DML, and the results will be the content of the table changed after the DML.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum:

    You want to keep only the maximum timestamp for the entire table, or you want the maximum timestamp for each distinct value of kpi_def_id?

    If it is just the maximum timestamp for the whole picture, then

    DELETE FROM kpi_logs

    WHERE the timestamp<>

    SELECT MAX (timestamp)

    OF kpi_logs

    );

    If you want to keep the maximum timestamp for each individual value phew kpi_def_id, then:

    DELETE FROM kpi_logs

    WHERE (kpi_def_id, timestamp NOT IN)

    SELECT kpi_def_id

    MAX (timestamp)

    OF kpi_logs

    GROUP BY kpi_def_id

    );

    assuming that no column can be NULL.

    Moreover, the TIMESTAMP is a data type, similar to this DAY.  You'll only cause confusion by saying it is a type of data when it is really another.  In addition, TIMESTAMP is a keyword from Oracle, is not a very good column name.  Why not give your column a name more meaningful, accurate, such as create_date or entry_dt?

  • Need to display more than two columns in the game now (library view)

    The current reading list (under the library, not the instant game tab menu tab a top of the player) shows only two columns, the title and duration.  I can't add more columns by selecting choose columns, or restore the columns.  I have this problem with one of the entries in the left column of the display of the library (like, songs, recently added, etc.).  Is there a way can I fix?

    It's machine running a version of Windows XP on the computer and WMP11.  I had Windows XP and media player 11 on my laptop for several years and have had this problem.  I don't know what is different between the two machines that causes this problem.

    Yes, it seems to be more at hand than just differences in operating system. However, I think I found a way to get more columns in the game now:

    1 restart WMP, start to play music and go to playback.

    2. click on the heading of column Title to sort by title.

    3. switch to another view (for example songs ) and go back to playing now. You should already see the additional columns now.

    4. to make the columns 'stick' between reboots WMP, you also needed to right click on the column header in the current playback, select Choose columns , uncheck automatically hide columns and click OK .

    Tim Baets
    http://www.BM-productions.TK

  • More than one column in a row

    Hi, I have a table has a 2 column layout.

    id_dep id_val
    --------- --------
    1A
    1 B
    1 C
    2 G
    3 L
    2.
    3 P
    3 X

    I need a view or a table that displays data like this.

    id_dep id_val1 id_val2 id_val3 id_val4
    --------- ---------- ---------- ---------- ----------
    1 C
    2 G
    3 L O P X

    I have seen a few examples with values in the same column, but I really need separate field for each value.

    Any help would be much appreciated,

    Thank you! We use Oracle 10.

    Hello

    Welcome to the forum!

    As Centinul said, it's called swivel and the Centinul post link has several good pages.

    Something crucial about swing is that before you do rotate, you know, look at each line of no cross-data Dynamics, rows and columns will be affected by this line. For example, looking at the line with id_dep = 2 and id_val = 'G', how can tell you where (what row and column) who will go 'G '? id_dep uniquely identifies the line, but there is nothing in the table that indicates if the 'G' will end up in the 1st column crosstab, or 2nd or 3rd, or... Before you can rotate the data, you must generate a number for yourself.

    Since I don't have a copy of your table, I'll use the table scott.emp to illustrate. Say we want to list the employees in each Department, in alphabetical order, like this:

    `   DEPTNO NAME1      NAME2      NAME3      NAME4
    ---------- ---------- ---------- ---------- ----------
            10 CLARK      KING       MILLER
            20 ADAMS      FORD       JONES      SCOTT
            30 ALLEN      BLAKE      JAMES      MARTIN
    

    Deptno column (like you id_dep) is all we need to know about what an exit row corresponds to each input line, but we must build something which says "CLARK" will go in the same column as "ADAMS" and "ALLEN". This soemthing is in this case, the ROW_NUMBER analytic function:

    WITH     got_r_num     AS
    (
         SELECT     deptno, ename
         ,     ROW_NUMBER () OVER ( PARTITION BY  deptno
                                   ORDER BY          ename
                           )         AS r_num
         FROM    scott.emp
    --     WHERE     ...     -- If you need any filtering, this is where it goes
    )
    SELECT       deptno
    ,       MIN (CASE WHEN r_num = 1 THEN ename END)     AS name1
    ,       MIN (CASE WHEN r_num = 2 THEN ename END)     AS name2
    ,       MIN (CASE WHEN r_num = 3 THEN ename END)     AS name3
    ,       MIN (CASE WHEN r_num = 4 THEN ename END)     AS name4
    FROM       got_r_num
    GROUP BY  deptno
    ;
    

    Thanks for posting your version number; It's always good to do whenever you have a question. Sometimes the difference between Oracle 10.1 and 10.2 can be important. It is best if you post your full version, for example 10.2.0.4.0.
    The query above works in Oracle 9 and 10. Of course, it will not work in higher versions, too, but if you have Oracle 11 then you would like to use the SELECT new... PIVOT functionality, instead.

  • You are looking for in more than 1 column

    I have data in the following way

    prjcountry Clntcountry otherxcountry otherycountr
    -------------- -------------- ------------------- -------------------
    India Sri Lanka we UK

    I want to search in all 4 coulms. I can write a query like

    Select * from country_tab
    where prjcountry = < search_country > or Clntcountry = < search_country >
    or otherxcountry = < search_country > or otherycountry = < search_country >

    is there a way to better/effective to do?

    Hello

    Geffroy wrote:
    I have data in the following way

    prjcountry Clntcountry otherxcountry otherycountr
    -------------- -------------- ------------------- -------------------
    India Sri Lanka we UK

    I want to search in all 4 coulms. I can write a query like

    Select * from country_tab
    where prjcountry = and Clntcountry =
    or otherxcountry = or otherycountry =

    is there a way to better/effective to do?

    Why do you have 4 different columns? Why not for 4 rows in another table?

    Since you have 4 columns in a table:

    WHERE     IN (prjcountry, clntcountry, otherxcountry, otherycountry)
    

    I don't know if it is more efficient.

  • End of the file has detected the error for more than one column of a PDM file playback

    Hello fans of LabVIEW,.

    I write the data in several columns of a PDM file. After that, I would like to read the data in each column to treat it.

    writing data works without any problem, if I get a PDM file with say 4 columns of data. When I try to read these columns now, LabVIEW always gives me error 4 "end of file" for all but a PDM read functions. Regardless of the number of columns I've read or how big they are, its still the same. LabVIEW reads a column and gives the error for all other tdms read functions.

    Does anyone has an idea how to solve this problem?

    A picture of my VI and the error is attached.

    Pls find attached extract

  • Understand the joins with more than one column?

    Hi all

    I want to know if I understand.

    When you join two tables, and the join condition has four columns (two for each table) as follows:

    where d.deptno = e.deptno

    and d.name = e.name

    I think it means the engine must choose "the selection list" when he sees a number of d.deptno (for example 10) equal number in e.deptno, and

    the d.name from the same folder (10) must be equal to the value of e.name.

    I understand?

    Another example, I want to understand, when we say:

    where d.deptno = e.deptno

    and d.deptno = s.deptno

    This means that the number (10) should for example equal to one (10) in the table (e), and the same 10 must be equal to a value in the table (s)?

    Am I wrong?

    Thank you

    Hello

    Yes, what you say is right; but don't take my word for it.  Try it yourself.   Create a couple of small tables.  Insert some data that matches (and will appear in the results of joints) and others that does not (and should not be in the results) and see if the results are what you expected.

Maybe you are looking for

  • I can't text from my computer.

    Something has changed. I locked to iTunes and when I tried to unlock it and do it by e-mail, he sent emails to the email address of my wife. I finally changed my password and unlocked, now I can't text of my Macbook Pro. Who can help me please? Jerry

  • Equium begins typing the letter 'o' in itself

    Hello I've noticed lately that my computer starts to type the letter 'o' in itself. Sometimes it gets really bad and I can't type anything correctly. Do you think it is a virus or is this something wrong with my keyboard?Can I use the recovery disk a

  • Update KB951847 fails: 800F0900

    Whenever I try to use Windows Update, this update will fail:-KB951847: Microsoft .NET Framework 3.5 Service Pack 1 and the .NET Framework 3.5 Family Update x 86I still have the error 800F0900. I tried to download manually (from the Download Center),

  • MSN messenger disappeared

    My msn messenger suddenly disappeared from my tool bar and I can't get in any other place.

  • My video card is released. How can I transfer files from computer A to computer B w/out see comparison screen?

    The video card on my computer came out and the laptop must be sent repair. I have another laptop, but I need to get my files off the damaged before you send it. How can I do this with/without see the damaged screen on the laptop?