GROUP BY with multiple columns.

I have a little query on the GROUP BY clause.

Sometimes, we will give several names of columns in GROUP BY. If it behaves in the same way as ORDER BY (multi-column) I wish I had an example where I can use GROUP BY multiple columns. in any case regardless of his behaviour, it will be really appreciated if someone can explain a scenario where GROUP BY with multiple columns can be used.

I know about the use of GROUP BY aggregate functions, but using a single column.

Thank you.. !!!

No, not like that

I think that Group by does not follow any order...

If we execute like this

SELECT registrationid, dateofbirth, sum (age) FROM prawin62 WHERE registrationid = 22 GROUP BY dateofbirth, registrationid.

22     1/23/1975     54
22     5/18/2011     330

It will give the same result based on date of birth...

~ Praveen

Tags: Database

Similar Questions

  • Gears - error when you try to insert values into a table with multiple columns

    Hello

    I started playing with the gears and SQlLite today and I get an error when I try to insert values into a table with multiple columns.

    I have:

    var db = google.gears.factory.create('beta.database');
        db.open('developerSet');
        db.execute('create table if not exists Developers (DeveloperName text, DeveloperAge int)');
    
        var devName = "Davy"
        var devAge = 32;
    
        try {
            db.execute('insert into Developers values (?, ?)', [devName, devAge]);
            alert('success');
        }
        catch (e) {
            alert(e);
        }
    

    I get the error:

    net.rim.device.api.database.DatabaseException; insert into developers values (?,?): SQL logic error or missing database.

    I use this reference: http://code.google.com/apis/gears/api_database.html

    Everything works if I have only one field as:

    var db = google.gears.factory.create('beta.database');
        db.open('developerSet');
        db.execute('create table if not exists Developers (DeveloperName text)');
    
        var devName = "Davy"
        var devAge = 32;
    
        try {
            db.execute('insert into Developers values (?)', [devName]);
            alert('success');
        }
        catch (e) {
            alert(e);
        }
    

    I use the plug-in Visual Studio 2.0 for 2008 that are running Windows XP SP and Simulator 2.13.0.56

    Thank you

    Davy

    Yes, a SQLite database will persist between battery pulls.  The database is registered either to internal MEM or removable media (not the device memory), depending on which is available on your device.

    In general, its not considered a best practice to remove your table as soon as it is empty and re - create it again when you want to add data.  This adds extra overhead fresh for the final, delete and insert first for a given table.  Instead, define and finalize your drawing before you create your table.  Once created, review the static schema.

    That being said, for development purposes, it may be easier to provide an easy way to drop your tables while you develop your schema.

    See you soon,.

    Adam

  • Call a select stmt with multiple columns inside another column

    Hi all

    I have a question about the appeal of a select statement, which is to have multiple columns inside another select statement.

    I know that we can use inline views to retrieve data from another table within a query as shown below.

    SELECT (SELECT dname FROM dept WHERE deptno = e.deptno), deptno, sal FROM emp e;

    Now, I'm going to pull the loc also column within the same view of inline. But oracle is not allowing me to do the same thing.

    Is there a way we can achieve the same thing because I don't want to hit the area two times table each time for each emp record.

    Appreciate your valuable suggestions.

    Thank you
    Madhu K.

    Maybe just a simple outer join?

    select ut.subscriberid
          ,ut.unitid
          ,ut.install_date
          ,nvl(tuh.hardwaretype, 'NO_HW')
    from   tt_unit ut
    left   join tt_unit_hwtype tuh
    on     tuh.unitid = ut.unitid
    where  trunc(ut.install_date) >= V_CONST_PROG_START_DT;
    
  • Declare a type of table with multiple columns

    I have a table with a column of type, and I want to create one with two columns.

    My type is:
    create or replace type "NUMBER_TABLE" in the table of the number;

    And I use it in function:

    FUNCTION GetValues()
    return NUMBER_TABLE
    as
    results NUMBER_TABLE: = NUMBER_TABLE();
    Start
    Select OrderId bulk collect in: results from (select * from tbl_orders);
    -Other code...
    end;

    I want select it be like this:
    Select OrderId, OrderAddress bulk collect into: results from (select * from tbl_orders);

    How to do this?

    Is that what you are looking for:

    CREATE OR REPLACE TYPE two_col_rec AS OBJECT (empno NUMBER, ename VARCHAR2(10))
    /
    
    CREATE OR REPLACE TYPE two_col_table AS TABLE OF two_col;
    /
    
    CREATE OR REPLACE FUNCTION GetValues RETURN two_col_table AS
       results two_col_table := two_col_table();
    BEGIN
       SELECT two_col(empno, ename) BULK COLLECT INTO results FROM emp;
       --
       RETURN results;
    END;
    /
    show errors
    
  • ComboBox with multiple columns

    Is it possible to make a ComboBox with two columns in the drop-down list box?

    Thank you

    Use the dropdownwidth property

  • Group by returning multiple columns in a single request

    Hello

    Sorry to ask this simple question, I suppose, but here's my problem.

    I am building a query to get to say the smallest user_id of workers in society by Department.

    The query goes like:

    Select emp... Department,
    min (EMP.user_id)
    employee emp
    Emp.department group

    It gives me the smallest user by Department id, which is what I want. But how can I also get the name of this person?

    I know that the condition of 'min' distinguishes a single record (there are no two people with the same user_id in the Department).
    But how can I also get the name without turning the query above in a subquery that I would like to once again a link to the table of employees?

    I know that the following works, but I don't think it's the best option:

    Select v1.department,
    v1.user_id,
    Emp1.name
    employee emp1.
    (select emp... Department,
    min (EMP.user_id)
    employee emp
    Group emp.department) v1
    where emp1.user_id = v1.user_id


    This is just one example of data. This is the principle which I don't understand.

    Any advice would be much appreciated.

    Cyril

    Hi, Cyril.

    To find the name of the person who has the lowest user_id

    SELECT    department
    ,         MIN (user_id)   AS lowest_user_id
    ,         MIN (name) KEEP (DENSE_RANK FIRST ORDER BY user_id)  AS person_with_lowest_user_id
    FROM      emp
    GROUP BY  department;
    

    'MIN (name)' above means that if there is a link for the lowest user_id, you will choose the candidate with the first name.

    If you want to display several columns in the row with the lowest user_id, you must have an expression of 'KEEP (DENSE_RANK...)' separate for each column. In this case, you will find may be easier to use the RANK or the analytical ROW_NUMBER in a subquery, like this:

    WITH  sub_query  AS
    (
         SELECT  department
         ,     user_id
         ,     name
         ,     col2, col3, col4, col5
         ,     RANK () OVER ( PARTITION BY  department
                               ORDER BY          user_id
                        )  AS r_num
         FROM     emp
    )
    SELECT     *     -- or list all columns EXCEPT r_num
    FROM     sub_query
    WHERE     r_num = 1;
    
  • create xmlindex structured with multiple columns reflecting different XPath expressions

    I run a XMLEXISTS query to return documents that contain a specific search template. The search model is based on two distinct XPATHS. I tried to create an XML Index structured to support the request. While I can make it work when I specify that a XPATH, I can't make it work when I specify both.

    Oracle version: 11.2.0.3

    extendeddata / / DESC

    Name                                      Null?    Type

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

    U NOT NULL VARCHAR2 (14)

    XMLCONTENT NOT NULL SYS. XMLTYPE BINARY STORAGE

    ROWINSERTDATE NOT NULL DATE

    XMLSIZE NOT NULL NUMBER (10)

    DATAIMPORTID NOT NULL VARCHAR2 (100)

    MESSAGEFLOWNAME NOT NULL VARCHAR2 (200)

    Table is partitioned by month on ROWINSERTDATE

    XMLType column stored as files secure.

    Here's the query...

    SELECT u, xmlcontent

    To extendeddata

    WHERE the XMLEXISTS ('declare namespace CAMT54 = "urn: iso: std: iso: 20022:tech:xsd:camt.054.001.02";)

    $p / CAMT54:Document / CAMT54:BkToCstmrDbtCdtNtfctn / CAMT54:Ntfctn [CAMT54:Acct / CAMT54:Id / CAMT54:IBAN = $iban]

    [and CAMT54:Ntry / CAMT54:CdtDbtInd = $ctddbtind]' Xmlcontent passing that 'p ',.

    "XXXXXXXXXXXXXXXXXXXXXX" AS "iban",.

    "DBIT" as "ctddbtind")

    AND rowinsertdate > = TO_DATE (' 2014-06-01 00:00:00 ',' ' SYYYY-MM-DD HH24:MI:SS)

    AND rowinsertdate < TO_DATE (' 2014-07-01 00:00:00 ',' SYYYY-MM-DD HH24:MI:SS');

    Here's the index...

    CREATE INDEX EXTENDEDDATA_XML_IDX1 ON EXTENDEDDATA (XMLCONTENT)

    INDEXTYPE IS XDB. XMLIndex LOCAL SETTINGS (' XMLTable EXTENDEDDATAIBAN)

    XMLNAMESPACES ("urn: iso: std: iso: 20022:tech:xsd:camt.054.001.02" as "CAMT54").

    "/ CAMT54:Document / CAMT54:BkToCstmrDbtCdtNtfctn / CAMT54:Ntfctn"

    COLUMNS

    IBAN VARCHAR (34) PATH "CAMT54:Acct / CAMT54:Id / CAMT54:IBAN".

    CTDDBTIND varchar (4) PATH "CAMT54:Ntry / CAMT54:CdtDbtInd" ');

    CREATE INDEXES SEPA_PAY. EXTENDEDDATAIBAN_IDX1 ON EXTENDEDDATAIBAN (IBAN, CTDDBTIND)

    TABLESPACE SEPA_PAY_BIG_IDX;

    exec dbms_stats.gather_table_stats (ownname = > 'SEPA_PAY', tabname = > 'EXTENDEDDATA');

    Here is the plan to explain it...

    PLAN_TABLE_OUTPUT

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

    Hash value of plan: 417322092

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

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |

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

    |   0 | SELECT STATEMENT |              |  1050 |   648KO |    38 (0) | 00:00:01 |       |       |

    |*  1 |  FILTER |              |       |       |            |          |       |       |

    |   2.   RANGE OF SINGLE PARTITION |              |  1050 |   648KO |    32 (0) | 00:00:01 |    16.    16.

    |   3.    TABLE ACCESS FULL | EXTENDEDDATA |  1050 |   648KO |    32 (0) | 00:00:01 |    16.    16.

    |   4.   SEMI NESTED LOOPS.              |     1.     6.     6 (0). 00:00:01 |       |       |

    |   5.    SEMI NESTED LOOPS.              |     1.     4.     4 (0) | 00:00:01 |       |       |

    PLAN_TABLE_OUTPUT

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

    |   6.     XPATH EVALUATION.              |       |       |            |          |       |       |

    |*  7 |     XPATH EVALUATION.              |       |       |            |          |       |       |

    |*  8 |    XPATH EVALUATION.              |       |       |            |          |       |       |

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

    Information of predicates (identified by the operation identity card):

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

    1 Filter (EXISTS (SELECT / * + < impossible >))

    7 - filter("P2"."$ C_01"="DBIT')

    8 - filter("P1"."$ C_01"="XXXXXXXXXXXXXXXXXXXXXX')

    PLAN_TABLE_OUTPUT

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

    Note

    -----

    -Construction detected no optimized XML (activate XMLOptimizationCheck for more information)

    The following is an extract from the XML file...

    " < document xmlns: xsi =" http://www.w3.org/2001/XMLSchema-instance "xmlns =" urn: iso: std: iso: 20022:tech:xsd:camt.054.001.02 "" >

    < BkToCstmrDbtCdtNtfctn >

    < GrpHdr >

    < MsgId > NFTTEST201311060150412 < / MsgId >

    < CreDtTm > 2013 - 11 - 06T 15: 04:12 < / CreDtTm >

    < / GrpHdr >

    < Ntfctn >

    < id > 00001 / < ID >

    < CreDtTm > 2013 - 11 - 06T 15: 04:12 < / CreDtTm >

    < Acct >

    < id >

    XXXXXXXXXXXXXXXXXXXXXX < IBAN > < / IBAN >

    < /ID >

    < / Acct >

    < do >

    < Amt CTL = "EUR" > 89.00 < / Amt >

    < CdtDbtInd > DBIT < / CdtDbtInd >

    < m > BOOK < / m >

    < BkTxCd >

    < Prtry >

    < Cd > 99999999999999 < CD >

    < / Prtry >

    < / BkTxCd >

    < NtryDtls >

    < TxDtls >

    < refs >

    < Course > 999_99999999 < / course >

    < MndtId > str1234 < / MndtId >

    < / refs >

    < AmtDtls >

    < TxAmt >

    < Amt CTL = "EUR" > 89.00 < / Amt >

    < / TxAmt >

    < / AmtDtls >

    < BkTxCd >

    < Domn >

    < Cd > < CD > SEPA

    < Montaut >

    < Cd > < CD > SEPA

    < SubFmlyCd > CORE < / SubFmlyCd >

    < / Montaut >

    < / Domn >

    < / BkTxCd >

    < RltdPties >

    < UltmtDbtr >

    str1234 < n > < /Nm >

    < id >

    < OrgId >

    < BICOrBEI > XXXXXXXX < / BICOrBEI >

    < Scout >

    str1234 < id > < /ID >

    < SchmeNm >

    str1 < Cd > < CD >

    < / SchmeNm >

    str1234 < HIRS > < / HIRS >

    < / Scout >

    < / OrgId >

    < /ID >

    < / UltmtDbtr >

    < Instantane >

    str1234 < n > < /Nm >

    < PstlAdr >

    < Ctry > IE < / Ctry >

    < AdrLine > str1234 < / AdrLine >

    < / PstlAdr >

    < / Instantane >

    < CdtrAcct >

    < id >

    XXXXXXXXXXXXXXXXXXXXXX < IBAN > < / IBAN >

    < /ID >

    < CTL > EUR < / CTL >

    < / CdtrAcct >

    < UltmtCdtr >

    str1234 < n > < /Nm >

    < id >

    < OrgId >

    < BICOrBEI > XXXXXXXX < / BICOrBEI >

    < Scout >

    str1234 < id > < /ID >

    < SchmeNm >

    str1 < Cd > < CD >

    < / SchmeNm >

    str1234 < HIRS > < / HIRS >

    < / Scout >

    < / OrgId >

    < /ID >

    < / UltmtCdtr >

    < Prtry >

    < Tp > default SEPA < /TP >

    < Pty >

    < id >

    < PrvtId >

    < Scout >

    < id > < /ID > XXXXXXXXXXXXX

    < / Scout >

    < / PrvtId >

    < /ID >

    < / Pty >

    < / Prtry >

    < / RltdPties >

    < Purp >

    str1 < Cd > < CD >

    < / Purp >

    < RmtInf >

    < Ustrd > str1234 < / Ustrd >

    < Strd >

    < CdtrRefInf >

    < Tp >

    < CdOrPrtry >

    < Cd > SCOR < CD >

    < / CdOrPrtry >

    str1234 < HIRS > < / HIRS >

    < /TP >

    < ref > str1234 < / Ref >

    < / CdtrRefInf >

    < / Strd >

    < / RmtInf >

    < / TxDtls >

    < / NtryDtls >

    < / try >

    < / Ntfctn >

    < / BkToCstmrDbtCdtNtfctn >

    < / document >

    Can someone help me build an index for the query above?

    Thank you.

    This should work better, with the caveat explained above:

    SELECT t.*
    FROM extendeddata t
    WHERE XMLEXISTS('declare default element namespace "urn:iso:std:iso:20022:tech:xsd:camt.054.001.02";(::)
                   /Document/BkToCstmrDbtCdtNtfctn/Ntfctn[Acct/Id/IBAN=$iban]'
            Passing Xmlcontent,
                    'XXXXXXXXXXXXXXXXXXXXXX' AS "iban"
               )
    and XMLEXISTS('declare default element namespace "urn:iso:std:iso:20022:tech:xsd:camt.054.001.02";(::)
                   /Document/BkToCstmrDbtCdtNtfctn/Ntfctn[Ntry/CdtDbtInd=$ctddbtind]'
            Passing Xmlcontent,
                    'DBIT' as "ctddbtind")
    AND rowinsertdate >= TO_DATE(' 2014-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
    AND rowinsertdate < TO_DATE(' 2014-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
    ;
    

    (see how the predicates in each XQuery expression corresponds to the structure of the index)

    BTW, this kind of "DIY" XMLEXISTS works just as well.

    It emulates what we would have hoped for a single XMLExists in the first place:

    SQL> SELECT t.*
      2  FROM extendeddata t
      3  WHERE rowinsertdate >= TO_DATE(' 2015-06-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
      4  AND rowinsertdate < TO_DATE(' 2015-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
      5  AND EXISTS (
      6    SELECT null
      7    FROM XMLTable(
      8           XMLNamespaces(default 'urn:iso:std:iso:20022:tech:xsd:camt.054.001.02')
      9         , '/Document/BkToCstmrDbtCdtNtfctn/Ntfctn'
     10           passing t.xmlcontent
     11           COLUMNS IBAN      VARCHAR2(34) PATH 'Acct/Id/IBAN'
     12                 , CTDDBTIND VARCHAR2(4)  PATH 'Ntry/CdtDbtInd'
     13         ) x
     14    WHERE x.iban = 'XXXXXXXXXXXXXXXXXXXXXX'
     15    AND x.ctddbtind = 'DBIT'
     16  ) ;
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 409033022
    
    ---------------------------------------------------------------------------------------------------------------
    | Id  | Operation                             | Name                  | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                      |                       |     1 |   824 |     4  (25)| 00:00:01 |
    |   1 |  NESTED LOOPS                         |                       |     1 |   824 |     4  (25)| 00:00:01 |
    |   2 |   SORT UNIQUE                         |                       |     1 |    38 |     2   (0)| 00:00:01 |
    |   3 |    TABLE ACCESS BY INDEX ROWID BATCHED| EXTENDEDDATAIBAN      |     1 |    38 |     2   (0)| 00:00:01 |
    |*  4 |     INDEX RANGE SCAN                  | EXTENDEDDATAIBAN_IDX1 |     1 |       |     1   (0)| 00:00:01 |
    |*  5 |   TABLE ACCESS BY USER ROWID          | EXTENDEDDATA          |     1 |   786 |     1   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - access("SYS_SXI_1"."IBAN"='XXXXXXXXXXXXXXXXXXXXXX' AND "SYS_SXI_1"."CTDDBTIND"='DBIT')
       5 - filter("ROWINSERTDATE">=TO_DATE(' 2015-06-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "ROWINSERTDATE"		   
  • How to retrieve unique records with multiple columns

    I have a sps_prod table as described below-

    POGNAME VARCHAR2 (1500)
    INDEX #VERSION VARCHAR2 (200)
    POG_MODEL_STATUS VARCHAR2 (100)
    POG_LAYOUT_TYPE VARCHAR2 (500)
    POG_MARKET_SPECIFIC VARCHAR2 (500)
    POG_CONTACT_NUMBER VARCHAR2 (100)
    AREA_SUPPORTED VARCHAR2 (500)
    POG_COMMENTS VARCHAR2 (1500)
    POG_FOOTER_COMMENTS VARCHAR2 (1500)
    POG_ELECTRICAL_LIST_1 VARCHAR2 (1500)
    POG_ELECTRICAL_LIST_2 VARCHAR2 (1500)
    POG_CARPENTRY_1 VARCHAR2 (1500)
    POG_CARPENTRY_2 VARCHAR2 (1500)
    INSTALLATION_INSTRUCTION_1 VARCHAR2 (1500)
    INSTALLATION_INSTRUCTION_2 VARCHAR2 (1500)
    FIXTURE_REORDER_NUMBER VARCHAR2 (200)
    FIXTURE_ID VARCHAR2 (200)
    FIXTURE_NAME VARCHAR2 (500)
    FIXTURE_IMAGE VARCHAR2 (500)
    PART_REORDER_NUMBER_9 VARCHAR2 (500)
    PART_FIXTURE_ID_9 VARCHAR2 (500)
    PART_FIXTURE_NAME_9 VARCHAR2 (500)
    PART_FIXTURE_IMAGE_9 VARCHAR2 (500)
    UPC VARCHAR2 (50)
    ITEM_NUMBER VARCHAR2 (50)
    DESCRIPTION VARCHAR2 (700)
    MERCH_TYPE VARCHAR2 (20)
    HEIGHT VARCHAR2 (100)
    WIDTH VARCHAR2 (100)
    DEPTH VARCHAR2 (100)
    DATE OF CREATE_TS

    There are 4 million records in it and many with the same combination of POGName, #Version, POG_Model_Status, POG_Layout_Type, POG_Market_Specific, POG_Contact_Number and Fixture_Name Index. How do the records to retrieve all the columns above, but with a unique combination of fixture_name and reorder_number. It has no keys defined on the table.

    I guess that it is a simple problem but the fact I'm trying to retrieve all the columns I'm stumbling.

    Thanks in advance.

    Hello

    Sanders_2503 wrote:
    ... There are 4 million records in it and many with the same combination of POGName, #Version, POG_Model_Status, POG_Layout_Type, POG_Market_Specific, POG_Contact_Number and Fixture_Name Index. How do the records to retrieve all the columns above, but with a unique combination of fixture_name and reorder_number.

    I don't see a column named reorder_number. Do you mean fixture_reorder_number or part_reorder_number_9?

    So, you want only one row for each distinct combination of fixture_name and some other column (I'll assume it's fixture_reorder_number). Does it matter which line? They will not necessarily have the same values for the other columns.
    The following query returns the one with the first pogname (in sort order):

    WITH     got_r_num     AS
    (
         SELECT  pogname, index#version, pog_model_status, pog_layout_type
         ,     pog_market_specific, pog_contact_number, fixture_name
         ,     ROW_NUMBER () OVER ( PARTITION BY  fixture_name
                                   ,                    fixture_reorder_number
                             ORDER BY        pogname
                           )         AS r_num
         FROM    sps_prod
    )
    SELECT  pogname, index#version, pog_model_status, pog_layout_type
    ,     pog_market_specific, pog_contact_number, fixture_name
    FROM     got_r_num
    WHERE     r_num     = 1
    ;
    

    If there be a tie (i.e. two or more lines with the same fixture_name, fixture_number and pogname first) and then the will be chosen arbitrarily.

    Instead of "ORDER BY pogname", you can ORDER all the other columns OR expressions, but you must have an ORDER byclause of analytics. You can do "ORDER BY NULL" If you really want pcik an arbitrary line.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and also publish the results you want from these data (or some examples of acceptable results).
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.

  • Report with multiple columns NUMBER of counts of the same table

    I am new to discoverer, so I'm a little lost.

    I work to create a report to show usage data and Knowledge Base of e-business. I have written using subqueries in SQL query that is in the format:

    Solution number | Soultion title | Solution views. Positive feedback | Negative feedback
    Title of 12345 _ 345 _ 98 34


    The entries 'Views', 'Positive' and 'Negative' are stored in the same table, so I do a count where setid = setid and usedtype = VS, then count where usedtype = usedtype and PF = NF

    Discoverer, I can get the number of solution, the title and THE totals but I can't seem to understand how to get an ACCOUNT for three different things from the same table in the columns on the same line.

    When I go on change map-> select the items once I select the option NUMBER of the UsedType column in the CS_KB_SET_USED_HISTS table, I can't select it again. I also found way now to add a column based on a query entered.

    If someone could help it would be much appreciated.

    Thank you

    Published by: Toolman21 on December 2, 2010 14:17
    _ to correct spacing added.

    Hello
    You can separate the column with a case or decode.
    for example to create 2 calculations:

    case
    When usedtype = "PF".
    then - that contain both
    0 otherwise
    end

    case
    When usedtype = 'NF '.
    then - that contain both
    0 otherwise
    end

    After that, you can create the aggregation count on those.

    Tamir

  • Histogram with multiple columns

    I use a CFC to enter data in a database.  Data from looks like this

    Jan 100 cars

    Jan 150 trucks

    Jan 125 bikes

    Feb 112 cars

    Feb 132 trucks

    Feb 121 bikes

    etc.  I want a chart bar to see the numbers on the left and the month along the bottom.

    When I import it, it leaves two empty columns then shows the bikes from Jan.  When I add another series, it does the same thing.  What I want is for the data to be left aligned and have Jan and a column for each item, then have Feb and a column for each element.

    Coming from my data via

    event.result = inventory

    as Collection ArrayCollection;

    < mx:ColumnChart

    y=" 40 "

    ID ="

    myChart "

    dataProvider ="

    {inventory} "

    showDataTips ="

    true "

    selectionMode ="

    unique "

    width ="

    100% "height =" " 100% " >

    <! - vertical axis - >

    < mx:verticalAxis >

    < mx:LinearAxis " baseAtZero = ' true "

    < / mx:verticalAxis >

    < mx:horizontalAxis >

    < mx:CategoryAxis

    dataProvider ="

    {inventory} "

    categoryField ="

    sale " />

    < / mx:horizontalAxis >

    < mx:series >

    < mx:ColumnSeries

    Color ='

    #FFFFFF "

    xField ="

    month "

    yField ="

    sale " >

    < / mx:ColumnSeries >

    < mx:ColumnSeries

    Color ='

    #FFFFFF "

    xField ="

    month "

    yField ="

    sale " >

    < / mx:ColumnSeries >

    < / mx:ColumnChart >

    You need three ColumnSeries. Set the dataProvider of each directly (instead of setting for the ColumnChart) something like this:

    var car: ListCollectionView = new ListCollectionView();

    cars. List = inventory;

    cars.filterFunction = {function(item:Object):Boolean}

    return item ['category' / * or whatever your category field * /] == "cars."

    };

    Do something similar for the motorcycles and trucks. You can do something like this if you do not know the number of categories as well, but it's rather more complicated (and left as an exercise for the reader).

  • Unique table with several columns or several tables split?

    What is the best.

    A table with multiple columns inside or divided into several tables. Why?
    How will the performance in the two scenarios?

    Hello

    user13024762 wrote:
    I have a table EMP that has column EMP_ID, EMP_NAME MGR_ID, MGR_NAME, SALARY, EXP_IN_MNTHS, EXP_IN_YRS... etc with multiple columns

    I have the following tables
    EMP-> EMP_ID, EMP_NAME

    Each row in the table emp thie represents a separate employee. I guess other columns in the emp table might be birth_date, social_security_number and status (by example, 'Active', 'Leave', 'complete'). Here's what an employee has (at least) one of. If there is a one-to-many relationship between an employee and an attribute, then you probably want another table for this attribute.

    BISHOP-> EMP_ID, MGR_ID, MGR_NAME

    There is a one-to-many relationship between employees and managers? In other words, an employee may have 2 or more managers? If Yes, then you need another table.
    If there is only a one-to-one relationship between employees and managers (in other words, if an employee is never more than 1 Manager) so why don't you just have a mgr_id column in the emp table?
    Managers are also used for? (This is often the case, as in scott.emp and hr.employees.) If so, do not store their names in the EME and tables of mgr. Store name (and date of birth and other information) in the table emp only and, if you need a table of Bishop, just the emp_id and mgr_id column.

    SAL-> EMP_ID, SALARY

    There is a one-to-many relationship between the employees and wages? In other words, an employee may have 2 or more treatments? If so, how will you use the values? Is a special treatments in some way, as it will be used more often than others? (In other words, you may have a current and past wages salary, but the last wages are rarely used.)
    If you never have more than 1 salary for a given employee, why not just have a sal column in the emp table?

    EXP-> EMP_ID, EXP_IN_MNTHS, EXP_IN_YRS

    There is a one-to-many relationship between the employees and what whether you store in this table?

    etc. with more tables

    What is the best based on

    (1) performance and data recovery
    (2) ease of use
    (3) maintainability

    A one-to-many relationship requires an additional table. If an employee can have up to 3 managers, don't have mgr1, mgr2 and mgr3 columns in the emp table. Use a separate table, with up to 3 lines for the same employee, instead.
    For 1-1 relationships, it is usually best to not have separate tables.

  • Is possible to write the INSERT statement that fills two columns: 'word' and 'sense' of the file text with multiple lines - in each line is followed word that is the meaning?

    Is possible to write the INSERT statement that fills two columns: 'word' and 'sense' of the file text with multiple lines - in each line is followed word that is the meaning?

    Hello

    2796614 wrote:

    Is possible to write the INSERT statement that fills two columns: 'word' and 'sense' of the file text with multiple lines - in each line is followed word that is the meaning?

    Of course, it is possible.  According to what the text file looks like to, you can create an external table that treats the text file as if it were a table.  Otherwise, you can always read the file in PL/SQL, using the utl_file package and INSERT of PL/SQL commands.

    You have problems whatever you wantt?  If so, your zip code and explain what the problem is.

    Whenever you have any questions, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the exact results you want from these data, so that people who want to help you can recreate the problem and test their ideas.  In this case, also post a small sample of the text involved file.

    If you ask about a DML operation, such as INSERT, then 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: Re: 2. How can I ask a question on the forums?

  • Concatenate multiple columns in a single string

    Hello

    I use Oracle 11.2, how can I concatenate values from multiple columns in a string with an SQL:

    create table testTb (number (5) classId, class varchar2 (32));

    Insert into the testTb value (101, 'room101');
    Insert into the testTb value (101, 'room201');
    Insert into the testTb value (101, 'room301');
    Insert into the testTb value (202, 'room444');
    Insert into the testTb value (202, 'room555');

    I would like to generate the result as following:

    Class 101 is room101, room201, room301
    202 class is located in room444, room555

    Thank you

    Please post sample data.
    11.2 you can use LISTAGG:

    SQL> select 'Class '||classid||' is in '||listagg(classroom, ', ') within group (order by classroom)
     str
      2  from   testtb
      3  group by classid;
    
    STR
    --------------------------------------------------------------------------------
    Class 101 is in room101, room201, room301
    Class 202 is in room444, room555
    
    2 rows selected.
    
    SQL> 
    
  • How to make the Web Gallery with 3 columns of thumbnails?

    Hi all

    I used the gallery photo web to build a few sites, but always with thumbnails in a single, vertical, column within a framework that scrolls. and I have never mch liked this scroll bar.

    I came across this page:

    http://www.mariannekolb.com/recent.html

    that, as I look at the code, cannot even make use of web photo gallery, but is very similar.

    in any case, someone in this group has an idea how this miniature of multiple column (without scroll bar) is completed?

    Thank you

    the person that I'm building the site hate scrolling.

    In this case, choose a skin different (several to choose) and / or modify the CSS code to meet your needs.  jAlbum forums can help you.

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    http://ALT-Web.com/
    http://Twitter.com/ALTWEB

  • How to select entire groups or to multiple recipients in MAIL, rather than one at a time?

    How to select entire groups or to multiple recipients in MAIL, rather than one at a time?

    One way is to use the app to create a group with the intended recipients. Then when composing the email just type the group name in the To: field.

Maybe you are looking for

  • Regulator PID in SignalExpress?

    Hi all I'm about to order some equipment of NOR and in addition to data entry, I need to write a controller for a device external (PID, whatever) - for clarity - I want to read a voltage from a sensor and the output of any other voltage to the actuat

  • How can I get the Wordpad to stop the opening of my downloads?

    When attempting to open the downloaded documents, they're going straight to open them with WordPad. And WordPad is just coming up with computer giberish... Clearly in the code. Help, please!

  • Apple likes bar downstairs.

    How can I Gwet'in Apple as toolbar on Windows 7 OS?  I saw it on Windows 7 before. http://www.Macinstruct.com/new/images/columns/105/1051.jpg In this photo, it's at the bottom of the screen like apple every BONE.

  • SG300-20 - configure DHCP on the interface VLAN

    I have read the different partners of the discussions on the SG300 and SG500 going on regarding the high setting of VLAN and DHCP on VIRTUAL networks.  For some reason, I could not get even this simple task to work. First thing I did was update my ve

  • How to shoot to the top of the IP address of my computer

    Original title: cmd.exe What command in cmd.exe reveals the ip addresses that are on my system