Interview with conditional count columns

Hello again,

I need your help again.
Sample data:
DROP     TABLE     TABLE_1;

CREATE      TABLE      TABLE_1
   
(     "DEPT"           VARCHAR2 (1)
,      "PD"           VARCHAR2 (2)
,      "INMPD"      VARCHAR2 (5)
,     "AGE"          NUMBER
);

INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('A',               '12',     'FALSE',     TO_NUMBER('31')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('A',               '12',     'TRUE',          TO_NUMBER('15')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('A',               '12',     'TRUE',          TO_NUMBER('8')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('S',               '12',     'FALSE',     TO_NUMBER('31')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('S',               '12',     'TRUE',          TO_NUMBER('15')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('S',               '12',     'TRUE',          TO_NUMBER('8')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('A',               '05',     'FALSE',     TO_NUMBER('31')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('A',               '05',     'FALSE',     TO_NUMBER('15')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('A',               '05',     'TRUE',          TO_NUMBER('8')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('S',               '05',     'FALSE',     TO_NUMBER('31')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('S',               '05',     'FALSE',     TO_NUMBER('15')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('S',               '05',     'TRUE',          TO_NUMBER('8')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('A',               '02',     'FALSE',     TO_NUMBER('31')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('A',               '02',     'TRUE',          TO_NUMBER('2')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('A',               '02',     'TRUE',          TO_NUMBER('3')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('S',               '02',     'FALSE',     TO_NUMBER('31')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('S',               '02',     'TRUE',          TO_NUMBER('2')     );
INSERT      INTO      TABLE_1      (DEPT,               PD,      INMPD,          AGE)
                    VALUES           ('S',               '02',     'TRUE',          TO_NUMBER('3')     );
And my request:
SELECT           T1.DEPT
,               CASE
                    WHEN        TO_NUMBER(T1.PD) BETWEEN TO_NUMBER('01') AND TO_NUMBER('04')
                    AND          T1.INMPD = 'TRUE'
                    THEN     COUNT(*)
               END                               AS     "PD02"
,               CASE
                    WHEN        TO_NUMBER(T1.PD) BETWEEN TO_NUMBER('05') AND TO_NUMBER('08')
                    AND          T1.INMPD = 'TRUE'
                    THEN     COUNT(*)
               END                               AS     "PD05"
,               CASE
                    WHEN        TO_NUMBER(T1.PD) BETWEEN TO_NUMBER('09') AND TO_NUMBER('15')
                    AND          T1.INMPD = 'TRUE'
                    THEN     COUNT(*)
               END                               AS     "PD12"
,               COUNT(*)                         AS     "TOTAL"
FROM     TABLE_1     T1
GROUP BY     T1.DEPT
,               T1.INMPD
,               T1.PD
ORDER BY     T1.DEPT 
This query gives me a new line for each priority axis.
But I want a line for a Department like this:
DEPT                                                PD02                                                PD05                                                PD12                                               TOTAL
---- --------------------------------------------------- --------------------------------------------------- --------------------------------------------------- ---------------------------------------------------
A                                                      2                                                   1                                                   2                                                   9
S                                                      2                                                   1                                                   2                                                   9
PD02 online should be counted if the Democratic Party is between 01 and 04 and INMPD is set to TRUE.
PD05 online should be counted if the Democratic Party is between 05 and 08 and INMPD is set to TRUE.
PD12 online should be counted if the Democratic Party is from 09 to 15 and INMPD is set to TRUE.
TOTAL online should be the total of the values for the Department.

Thanks to you all.

Reini

Hello

Freakster235 wrote:
Hi Frank,.

That's right, the word "the" should be used 3 different words "der, die, das" in German.

You must use at least 3 different words. Don't "dem", "den" and "' also means 'the '?
In fact, you write very well English. In fact, you should write more of it: you should post an explanation of what you're trying to do. Can help people like me you write queries that get good results for small sets of sample data, but unless we understand why you want that the results, we could give you solutions that just happened to work for the small sample sets, more or less by chance.

... But thar isn't the truth ;) I have a total of 8 so not 4.

If you want to count separate orders; and create_date has nothing to do with this problem. Is this fair?
If so, do not use create_date in the GROUP BY clause from got_aggregates;. Use order_nr instead:

WITH     priorities          AS
(
     SELECT      '01' AS min_priority, '03' AS max_priority, 5 AS max_age  FROM dual  UNION ALL
     SELECT      '04',                  '08',                  8                FROM dual  UNION ALL
     SELECT      '09',                 '15',                 30             FROM dual
)
,     got_aggregates          AS
(
     SELECT    t1.dept
     ,       t1.priority
--     ,       t1.create_date     -- *****  NOT NEEDED  *****
     ,       MAX (CASE WHEN t2.wo_step = 'A' THEN t2.step_date END)     AS first_a_date
     ,       MAX (CASE WHEN t2.wo_step = 'U' THEN t2.step_date END)     AS last_u_date
     FROM               table_1     t1
     LEFT OUTER JOIN       table_2     t2  ON       t2.order_nr     = t1.order_nr     -- ***** CHANGED  *****
     GROUP BY  t1.dept
     ,       t1.priority
     ,       t1.order_nr          -- *****  CHANGED  *****
)
SELECT    a.dept
,       COUNT (CASE WHEN p.min_priority = '01' THEN 1 END)     AS pd02
,       COUNT (CASE WHEN p.min_priority = '04' THEN 1 END)     AS pd05
,       COUNT (CASE WHEN p.min_priority = '09' THEN 1 END)     AS pd12
,       COUNT (*)                                           AS total
FROM             got_aggregates  a
LEFT OUTER JOIN      priorities      p  ON   a.priority          BETWEEN  p.min_priority
                                                          AND      p.max_priority
                        AND  NVL ( a.last_u_date
                                  , SYSDATE
                              ) - a.first_a_date <= p.max_age
GROUP BY  a.dept
ORDER BY  a.dept
;

There is no need to include either create_date or order_nr in the SELECT got_aggregates clause.
In your new sample data, there is an order_nr that exists in table_1 but not in table_2. In order to count this order_nr, we use an outer join in got_aggregates.

The results should look like this:

DEPT  PD02  PD05  PD12  TOTAL
----  ----  ----  ----  -----
A        0     0     2      6
S        0     0     0      2

That's what I have now:

D       PD02       PD05       PD12      TOTAL
- ---------- ---------- ---------- ----------
A          0          0          2          6
S          0          0          0          2

Tags: Database

Similar Questions

  • How to avoid duplicates on a column with condition

    Hi all

    I need some advice here. At work, we have an Oracle APEX application that allow the user to add new records with the decision of the increment automatic number based on the year and the group name.

    Said that if they add the first record, group name AA, for 2012, they get the decision number AA 1 2013 as their record casein displayed page of the report.

    The second record of AA in 2013 will be AA 2 2013.

    If we add about 20 records, it will be AA 20 2013.

    The first record for 2014 will be AA 1 2014.

    However, recently, we get a claim of the user on two files of the same name of group have the same number of the decision.

    When I looked in the history table and find that the time gap between 2 record is about 0.1 seconds.

    In addition, we have the correspondence table which allows the user admin update the sequence number start with the restraint that it must be greater than the maximum number of the current name of the current year.

    This boot sequence number and the name of the group is stored together in a table.

    And in some other case, the user can add a decision duplicate for related record number. (this is a new feature)

    The current logic of the procedure to add the new record on the application are

    _Get max record table with selected group name (decision_number) and the current year.

    _INSERT in the folder table the new record came with the decision to number + 1

    _ update sequence number of the number of the decision just added.

    So instead of utitlising the process of editing the built-in automatic table of the APEX, I write a procedure that combine all three processes.

    I have run some loop for continually perform this procedure, and it seems that it can generate autotically new decision unique number with time about 0.1 second difference.

    However, when I increase the number of entry to 200 and let two users run 100 each.

    If the time gap is about 0.01 second, double decision numbers are displayed.

    What can I do to prevent duplicate?

    I can't just apply a unique constraint here for three columns with condition because it can be duplicated in some special conditions. I don't know much about the use of lock and its impact.

    This is the content of my procedure

    create or replace

    PROCEDURE add_new_case)

    -ID just use the trigger

    p_case_title IN varchar2,

    p_year IN varchar2,

    p_group_name IN VARCHAR2,

    -decisionnumber here

    p_case_file_number IN VARCHAR2,

    -active

    p_user in VARCHAR2

    )

    AS

    NUMBER default_value;

    caseCount NUMBER;

    seqNumber NUMBER;

    previousDecisionNumber NUMBER;

    BEGIN

    -execution immediate q '[alter session set nls_date_format = "dd/mm/yyyy"]';

    SELECT count (*)

    IN caseCount

    OF CASE_RECORD

    WHERE GROUP_ABBR = p_group_name

    AND to_number (to_char (create_date, "yyyy")) = to_number (to_char (date_utils.get_current_date, "yyyy"));

    SELECT max (decision_number)

    IN previousDecisionNumber

    OF CASE_RECORD

    WHERE GROUP_ABBR = p_group_name

    AND to_number (to_char (create_date, "yyyy")) = to_number (to_char (date_utils.get_current_date, "yyyy"));

    IF p_group_name IS NULL

    THEN seqNumber: = 0;

    ON THE OTHER

    SELECT Seq_number INTO seqNumber FROM GROUP_LOOKUP WHERE ABBREVIATION = p_group_name;

    END IF;

    IF caseCount > 0 THEN

    default_value: largest = (seqNumber, previousdecisionnumber) + 1;

    ON THE OTHER

    default_value: = 1;

    END IF;

    INSERT INTO CASE_RECORD (case_title, decision_year, GROUP_ABBR, decision_number, case_file_number, active_yn, created_by, create_date)

    VALUES (p_case_title, p_year, p_group_name, default_value, p_case_file_number, 'Y', p_user, sysdate);

    -Need to update the sequence here also

    UPDATE GROUP_LOOKUP

    SET SEQ_NUMBER = default_value

    WHERE the ABBREVIATION = p_group_name;

    COMMIT;

    EXCEPTION

    WHILE OTHERS THEN

    Logger.Error (p_message_text = > SQLERRM)

    , p_message_code = > SQLCODE

    , p_stack_trace = > dbms_utility.format_error_backtrace

    );

    LIFT;

    END;

    Many thanks in advance,

    Ann

    It's easier to solve for the case, while p_group_name is not null. In this case, you update a GROUP_LOOKUP line, so that you can select to update this line at the beginning, to prevent cases of two for the same group added at the same time. To do this, change the selection of GROUP_LOOKUP to:

    SELECT Seq_number INTO seqNumber FROM GROUP_LOOKUP WHERE ABBREVIATION = p_group_name for an updated VERSION OF the SEQ_NUMBER;

    and move this to be the first thing that did the procedure - before it has CASE_RECORD lines.

    In the case when p_group_name is set to null, you have some object to be locked. I think the best you can do is to lock the entire table GROUP_LOOKUP:

    the table lock in exclusive mode GROUP_LOOKUP wait 100;

    The '100 expectation' means that he will wait until 100 seconds before giving up and trigger an error. in practice, that is expected to only wait a moment.

    Exclusive mode allows others to read, but not to update the table.

    UPDATES and the LOCK of the TABLE will be updates of other sessions wait for this transaction to validate. Queries from other sessions are not affected.

    The locks are released when you commit or roll back.

  • XMLTable to extract columns with conditional path does not

    Hello

    I am on 11.2.0.3 and I need to extract columns on a section of XML with conditions on, but I get "ORA-00907: lack the right parenthesis", so I think that the way I go about it is not supported or that I have somehow the wrong syntax or something.

    This is a very simplified what I'm trying to do (there could be several different entries in the < sets1 > and < sets2 > sections and they might be in different orders, is not as if I can always choose the first or the last):

    with sample_data as (select 1 id,
                                xmltype('<root>
                                           <sets1>
                                             <set1><set_name>name1</set_name><set_val>val1</set_val></set1>
                                             <set1><set_name>name2</set_name><set_val>val2</set_val></set1>
                                           </sets1>
                                           <sets2>
                                             <set2><set_name>name3</set_name><set_val>val3</set_val></set2>
                                             <set2><set_name>name4</set_name><set_val>val4</set_val></set2>
                                           </sets2>
                                         </root>') xml_doc from dual)
    select *
    from   sample_data sd,
           xmltable('<root>' passing sd.xml_doc
                    columns col1 varchar2(10) path 'sets1/set1[set_name=''name1'']/set_val',
                            col2 varchar2(10) path 'sets1/set1[set_name=''name2'']/set_val',
                            col3 varchar2(10) path 'sets2/set2[set_name=''name4'']/set_val') x;
    

    What I'm trying to get:

    COL1  COL2  COL3
    ----  ----  ----
    val1  val2  val4
    

    I know that I could separate the < set1 > and < set2 > nodes in their own xmltypes xmltable on it and then join them and make the necessary pivoting, etc., but when I try to start that against only 1000 lines, db do not love and ended my session! Therefore, I'm looking for a more elegant way to do it.

    Is there a way to do this in a XMLTABLE? Pointers are very welcome!

    It solves your problem of sample request and you get the output that show you.

     with sample_data as (select 1 id,
                                 xmltype('
                                            
                                              name1val1
                                              name2val2
                                            
                                            
                                              name3val3
                                              name4val4
                                            
                                          ') xml_doc from dual)
     select x.*  -- change
     from   sample_data sd,
            xmltable('/root' passing sd.xml_doc  -- change
                     columns col1 varchar2(10) path 'sets1/set1[set_name="name1"]/set_val',  -- change
                             col2 varchar2(10) path 'sets1/set1[set_name="name2"]/set_val',  -- change
                             col3 varchar2(10) path 'sets2/set2[set_name="name4"]/set_val') x;  -- change
    

    As you can see, I've marked the lines that I've changed.  The error you saw came to use two single quotes in the COLUMN XPath instead to use double quotes.  Then I changed the XPath expression in the XMLTable brackets as well.

    I'm confused on what the columns you really want overall, in terms of how you know which values you want, or did you mean that you want something random sets1 and sets2.

    You store the XML file in a column of XMLType SECUREFILE BINARY, right?  It seems that you made previous visits, but just double check.

  • How to INSERT a SELECT statement with a GROUP BY clause on a table with an IDENTITY column?

    n an application, I intend to truncate and insertion on a 12 c Oracle database, but have found this problem with a IDENTITY column. Even if the INSERT... SELECT statement works on most SELECT uses I tried, if this statement was also a GROUP BY clause, it does not work, delivering a "ORA-00979: not a GROUP BY expression ' complaint. Some examples of code:

    create table aux ( owner_name varchar2(20), pet varchar2(20) ); 

    insert into aux values ('Scott', 'dog');

    insert into aux values ('Mike', 'dog');

    insert into aux values ('Mike', 'cat');

    insert into aux values ('John', 'turtle'); 


    create table T1 (

    id number generated always as identity,

    owner_name varchar2(20),

    pet_count number );

    select owner_name, count(*) as pet_count from aux group by owner_name; -- works just fine

    insert into T1 (owner_name, pet_count) select owner_name, count(*) as pet_count from aux group by owner_name; -- doesn't work

    The select statement works by itself, but it fails as an INSERT... SELECT statement.

    Appreciate the help!

    Looks like a bug. You must open the SR with Oracle. Meanwhile, you could materialize select:

    SQL > insert into T1 (owner_name, pet_count)
    2 with t as (select / * + materialize * / owner_name, count (*) as pet_count to the owner_name group)
    3. Select owner_name, pet_count t
    4.

    3 lines were created.

    SQL > select * from t1;

    ID OWNER_NAME PET_COUNT
    ---------- -------------------- ----------
    1 John                          1
    Scott 2 1
    3 Mike                          2

    SQL >

    Keep in mind index THAT MATERIALIZE is undocumented.

    SY.

  • join with condition

    Hi all

    Is there a possible way to cross the join with condition?

    I want something like this:

    Table A: custid, accu_id, sum

    CustID, accu_id unique =

    CustomerID amount accu_id

    10 25 400

    10 35 447

    10 29 420

    20 30 510

    30 35 472

    .

    .

    .

    Table b: accu_id, description

    accu_id description

    shoes 25

    Book 29

    30 computer

    pen 35

    Note: in table A, it is a mismatch of the accu_id values that do not use. Please, take into account this.

    I want to see all the columns in the TABLE B for each custid in A. TABLE (something like cross join but with ONE article.) The following query does not work.

    Select * from a right join B on A.accu_id = B.accu_id;

    10-25

    10-29

    10-30

    10-35

    20-25

    20-29

    20-30

    20-35

    30 25

    30 29

    30 30

    30-35

    What should I do for this?

    Thanks in advance

    Use partition outer join:

    with a (too)

    Select double union all 10 custid, accu_id 25, amount 400

    Select 10,35,447 from all the double union

    Select 10,29,420 from all the double union

    Select 20,30,510 from all the double union

    Select double 30,35,472

    ),

    b like)

    Select accu_id 25, "shoe" description of all the double union

    Select 29, 'book' from dual union all

    Select 30, 'computer' from dual union all

    Select 35, 'pen' from dual

    )

    Select a.custid,

    a.accu_id,

    a.amount,

    b.

    a

    by (a.custid) partition

    right join

    b

    On a.accu_id = b.accu_id

    order of a.custid,

    a.accu_id

    /

    AMOUNT ACCU_ID CUSTID DESCRIPT
    ---------- ---------- ---------- --------
    10 25 400 shoe
    10 29 420 book
    10 35 447 pen
    10 computer
    20 30 510 computer
    shoe 20
    book 20
    20                       pen
    30 35 472 pen
    30 shoe
    30 book

    AMOUNT ACCU_ID CUSTID DESCRIPT
    ---------- ---------- ---------- --------
    30 computer

    12 selected lines.

    SQL >

    SY.

  • Calculation of the sum with condition

    Hello
    I start with BI publisher, and I want to take a NAP with condition.

    My report output XLS, I haves columns, named ACCOUNT_TYPE and TREE_NODE and MOENTARY_AMOUNT_03 that are my PS query fields

    I want to sum only when a condition is true.

    <? xdofx:If ACCOUNT_TYPE = 'R' AND TREE_NOD = 'TEST' then
    Sum (MONETARY_AMOUNT_03)
    end if? >

    This does not,
    could you help me?

    thaks!

    You should do this:

  • How to conditionally hide column in pivot view

    I have bi 10.1.3.4.1 and I would like to hide some columns in pivot mode.

    I have this pivot table [http://img251.imageshack.us/img251/8633/screenshot016k.jpg]

    and I would sometimes hide metering, with sometimes a column with amount. For example if ColumnB = 'car' I want to show only the column with the County. If ColumnC = "money" I want to show only the column with amount.

    Is this possible or not?

    Thank you

    Hello
    Yes you are right. Can do it in this way if you want to show only fixed number of (static) column values, it dosent work if you want the values in the column to change dynamically.
    I don't think its possible to have this conditional formatting pivot who at the table dynamically. Better to look for an alternative. Check, make changes to tab (last tab) advanced

    Go through this can help somehow to work on the tab..http://obiee101.blogspot.com/2010/02/obiee-pivot-conditional-format-grand.html tip
    Otherwise wait for a response from experts to do that ;-)

    Kind regards
    Srikanth

  • How to compare one by an element of a column with the first column in the other table?

    Hello

    I have two files into a single file has only Id numbers and the second file has table with for example the column 4, and his first column identification number.

    So I want to compare the first item in the User.ID file with the 1st column all the table file items in this column until it finds matches.

    If compare match then LED will be IT other wise LED will be OFF.

    Here as an attachment, I've attached the two file.

    Please guide me how can I do the same thing.

    Thank you much in advance.


  • Write a SQL query with lines in columns

    All the

    I need help in writing a SQL query with lines in columns, let give u an example...

    drop table activity;

    CREATE TABLE 'ACTIVITY '.

    (

    "PROJECT_WID" NUMBER (22.0) NOT NULL,

    VARCHAR2 (150 CHAR) "PROJECT_NO."

    VARCHAR2 (800 CHAR) 'NAME '.

    );

    Insert in the ACTIVITY (PROJECT_WID, PROJECT_NO, NAME) values (1683691, '10007', 12-121');

    Insert in the ACTIVITY (PROJECT_WID, PROJECT_NO, NAME) values (1684994, '10008', 12-122');

    Insert in the ACTIVITY (PROJECT_WID, PROJECT_NO, NAME) values (1686296, '10009', 12-123');

    Insert in the ACTIVITY (PROJECT_WID, PROJECT_NO, NAME) values (2225222, '9040', 12-124');

    drop table lonet;

    CREATE TABLE 'LONET.

    (

    VARCHAR2 (150 CHAR) "NAME."

    NUMBER OF THE "ROOT."

    VARCHAR2 (150 CHAR) "ENTRYVALUE".

    );

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("GAC", 1683691, "LDE");

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('NAM', 1683691, 'LME');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('BAG', 1683691, 'ICE');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('PAP', 1683691, 'IKE');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('NAM', 1686291, "QTY");

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('PAP', 1686291, 'MAX');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("GAC", 1684994, "MTE");

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('PAP', 1684994, 'MAC');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('FMT', 1684994, 'NICE');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('FMR', 1684994, 'RAY');

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ('BAG', 1686296, "CAQ");

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("PAP", 1686296, "QAQ");

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("VANESSA", 1686296, "THEW");

    INSERT INTO LONET (NAME, ROOT, ENTRYVALUE) VALUES ("ANDR", 1686296, "REYL");

    commit;

    Link: activity.project_wid = lonet.root

    look like output

    Project_wid Project_no NAME GAC NAM BAG RAC
    16836911000712-121LDELMELCELKE
    16849941000812-122MTEnullnullMAC
    16862961000912-123nullnullCAQQAQ
    2225222904012-124nullnullnullnull

    two problems, in that I am running

    1. I dono how simply we can convert rows to columns

    2. for root = 1683691, there are double NAM and RAC in lonet table... ideally these data should not be there, but since its here, we can take a MAX so that it returns a value

    3. There are undesirables who should be ignored

    Once again my thought process is that we join the activity and 4 alias table lonet.

    ask for your help in this

    Thank you

    Hello

    This is called pivoting.

    Here's a way to do it:

    WITH relevant_data AS

    (

    SELECT a.project_wid, a.project_no, b.SID

    , l.name AS lonet_name, l.entryvalue

    Activity one

    LEFT OUTER JOIN lonet l.root = a.project_wid l

    )

    SELECT *.

    OF relevant_data

    PIVOT (MAX (entryvalue)

    FOR lonet_name IN ("GAC" IN the gac

    "NAM" AS nam

    'BAG' IN the bag

    "RAC" AS cars

    )

    )

    ORDER BY project_wid

    ;

    Output:

    PROJECT_WID PROJECT_NO GAC NAM BAG RAC NAME

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

    1683691 12 - 10007 121 LDE LME LCE LKE

    1684994 MAC MTE 10008 12-122

    1686296 12 - 10009 123 QAC QAQ

    2225222 9040 12 - 124

    To learn more about swivel, see the FAQ in the Forum: Re: 4. How can I convert rows to columns?

    Thanks for posting the CREATE TABLE and INSERT statements; It's very useful!

  • How to connect and to transcribe the interview with in first Pro CC

    I'm using Premiere Pro for the first time and I was wondering if anyone can point me to a good tutorial video and/or best practices for recording and the transcript interview with metadata of Premiere Pro and or the Metalogging window. The version of the application that I use is v9.2.0 Premiere Pro CC 2015 (41) Build on Mac OS X 10.11.4.

    Look at prelude CC as your logging application.

    Here is the blog post which may help you:

    Awesome' Blog Archive' magic with Adobe Logging prelude

    After you have created all your bookmarks, you can export it to a .csv, text or html for distribution - file

    and send the clips with markers to the first.

    MtD

  • How to write a query to return rows with the varchar column that contains even a single occurrence of the characters, such as Ÿ and

    How to write a query to return rows with the varchar column that contains even a single occurrence of the characters, such as Ÿ and

    I have a table whose columns with values such as

    MINNEAŸPOLIS and ¿VV ¿A

    Only the characters that are allowed in this column are alphabets, numbers, spaces, points and supports.

    Please help to write a SQL SELECT with Regexp_like query or any other option.

    Thanks to you all! Under query worked for me. Thank you Frank to explain the concept of hooks inside regexp_like.

    SELECT * FROM testspecial, WHERE REGEXP_LIKE (sampletext, "[^] ^ A - Z ^ a - z ^ 0-9 ^ [^.]") ^ {^} ^]') ;

  • Where to write the condition in the design of workflows with conditional step?


    Hello

    Again, I wish BP and workflow with contitional design stage.

    I had designed BP and workflow.

    As directed by the user for Udesigner guide, I had added trigger before the condition step.

    But I do not understand where to set the Condition to test?

    If I need to write the condition in triggering elemt itsel... How to proceed?

    for example, I want to write the condition as cost of Tota > = 100000, it must follow a path and if fails to another path.

    The conditions of triggers are specified in the workflow settings.  After you have created a new configuration, open it and click on the settings tab.  You will see a tree structure of the workflow with conditional branches.  Click a conditional branch to set the parameters for the trigger for this route condition.

  • Importing data with impdp table with 3 new columns

    Hello

    Is it possible to import data with impdp in tables with 3 new columns?

    Kind regards

    William

    To do this, I use this method:

    Add the three columns in the source table and create the package:

    CREATE OR REPLACE PACKAGE DATAPUMP_TECH_COLS

    IS

    FUNCTION SET_DML_DATE (p1 in TIMESTAMP)

    BACK TO TIMESTAMP;

    FUNCTION SET_DML_TYPE (p2 in VARCHAR2)

    RETURN VARCHAR2;

    FUNCTION SET_DML_SCN (p3 in NUMBER)

    RETURN NUMBER;

    END DATAPUMP_TECH_COLS;

    /

    CREATE OR REPLACE PACKAGE BODY SYS. DATAPUMP_TECH_COLS

    IS

    FUNCTION SET_DML_DATE (p1 in TIMESTAMP)

    RETURNS THE TIMESTAMP

    IS

    BEGIN

    SYSDATE RETURN;

    END;

    FUNCTION SET_DML_TYPE (p2 in VARCHAR2)

    RETURN VARCHAR2

    IS

    BEGIN

    RETURN ' ';

    END;

    FUNCTION SET_DML_SCN (p3 in NUMBER)

    RETURN NUMBER

    IS

    BEGIN

    RETURN 0;

    END;

    END;

    /

    Export a table with remap_data

    expdp = TEMP_DIR PARALLEL = 8 TABLES directory is PIVOTMAT2. ACCTG_LINE LOGFILE = expdp_acctg.log = COMPRESSION STATISTICS ALL EXCLUDE =.

    DUMPFILE = ACCTG1.dmp, ACCTG2.dmp, ACCTG3.dmp, ACCTG4.dmp, ACCTG5.dmp, ACCTG6.dmp, ACCTG7.dmp, ACCTG8.dmp REUSE_DUMPFILES = YES.

    REMAP_DATA = PIVOTMAT2. ACCTG_LINE. DML_TYPE:SYS. DATAPUMP_TECH_COLS. SET_DML_TYPE.------

    REMAP_DATA = PIVOTMAT2. ACCTG_LINE. DML_DATE:SYS. DATAPUMP_TECH_COLS. SET_DML_DATE.------

    REMAP_DATA = PIVOTMAT2. ACCTG_LINE. DML_SCN:SYS. DATAPUMP_TECH_COLS. SET_DML_SCN

    Import table

    Impdp "" / as sysdba "" DIRECTORY = SRC_PIVOT TABLE_EXISTS_ACTION = TRONQUER REMAP_SCHEMA = PIVOTMAT2:STGPIV.

    DUMPFILE = ACCTG1.dmp, ACCTG2.dmp, ACCTG3.dmp, ACCTG4.dmp, ACCTG5.dmp, ACCTG6.dmp, ACCTG7.dmp, ACCTG8.dmp PARALLEL = 8

    to complete the removal of the collar if necessary.

  • Line 1 columns do not merge with Row 2 columns in InDesign Script

    It is my code: -.

    var myTableFrame.insertionPoints = myTable [0].tables.add ({columnCount:3, headerRowCount:1, bodyRowCount:2});})

    myTable.rows [0] .cells [0] .silence = "A";

    myTable.rows [0] .cells [0].merge(myTable.rows[1].cells[0]);

    But:-below the job line: -.

    myTable.rows [0] .cells [0].merge(myTable.rows[0].cells[1]);

    myTable.rows [1] .cells [0].merge(myTable.rows[2].cells[0]);


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

    Problem is that column 1 & 2 of the fusion of line 1

    and the column 1 row 2 & 3 fusion

    but, to the column 1 rank 1 & 2 fusion has not and no column of row 1 merger with column of line 2

    Can someone help me please...

    Thank you...

    Problem solved: -.

    1. we cannot merge with bodyRow headerRow columns...

    2. we can merge with headerRow headerRow columns...

    3. we can merge with bodyRow bodyRow columns...

    In the case of line 1 should be used below line: -.

    var myTableFrame.insertionPoints = myTable [0].tables.add ({columnCount:3, headerRowCount:2, bodyRowCount:2});})

    OR

    var myTableFrame.insertionPoints = myTable [0].tables.add ({columnCount:3, bodyRowCount:3});})

  • Reactive layouts: publish multiple Sites with conditional Builds and which connect

    I hope that someone can provide a simple solution to publish problems I've had with adapted presentations when you try to publish several sites with conditional builds. Essentially, I want to be able to have an index page that links to one of the two variants of the published sites that I called 'General' and 'specific '. When I click on the 'general' link I want to not open the site which was published with a conditional for all these subjects compilation labeled as 'general' and when I click on the 'link' want it to open the site which was published using a conditional version for 'specific '.

    Here are the steps I took to create sites and can't seem to get to bind correctly:

    Table of contents, topic Creation and tagging content

    1. Creates a Table of contents.
    2. Added 2 topics in the Table of contents. The first topic, I called "general" and the second issue I called, 'specific '.
    3. I then click with the right button on the "general" and selected subject Tag to build conditional apply. From there, I've created a new tag called "General".
    4. I repeated this process to create the specific tag, but do a right-click on the 'specific' theme and the creation of a new tag called "specific".

    Layouts reactive and edited the sites based on the conditional tags

    1. Created sensitive presentation using the standard layout and content generated without any conditional builds.
    2. Duplicated sensitive put in page and gave him the content of 'general' then it is generated using the conditional, "General" version If the finished publication published content has shown that the 'general' subject, as expected.
    3. I then repeated the same process for the specific content and content using the version parole, generated 'specific '. When over content published showed that the subject marked as 'specific' as expected.

    Added an Index page to the table of contents

    1. Created a new topic to serve as the launch page.
    2. Added a 'general' hyperlink called for the launch of the general "theme found in the general publishes from the resource manager.
    3. Added a hyperlink called 'specific' to the launch of the general "theme found in the specific issues from the resource manager.
    4. I then republish the sensitive standard layout site.

    From this point, it gets stuck and won't open properly published Web sites. I don't know why it won't launch hyperlinks correctly. Is there something I'm missing? Let me know if you do not want to see my files. I will be gladly their.

    OK, thanks a lot for the capture screen. They help more than you realize.

    So here's one of the biggest mistakes I think that you have done so far. You use the resource manager to link to published results. If it is technically possible to do, I'm pretty sure Adobe never planned for it to be used this way.

    It may help to think in terms of creation of food products. I have long considered as RoboHelp to be very much like working in my kitchen. All consumables (heading text in the headings, images, HTML pages, etc.) are just as raw ingredients. (Eggs, milk, flour, etc.). The places of storage (hard drive) it's like the pantry and the fridge. And RoboHelp provides facilities to easily combine ingredients to create the different recipes.

    This next bit will be somewhat exaggerated, but bear with me. Maybe you have one or more neighbors and all you want to share some common "ingredients". If you set the things where each of you have access to a wine cellar and a shared refrigerator. Maybe you do a Dutch sauce killer. You create it and place in the refrigerator, then your other participants have access through the common "fridge". This is exactly what the resource manager is intended to help.

    Now assume that you create something like cookies chocolate chip and you keep in the refrigerator. Well, that's fine, but you don't want to use cookies to chocolate chip already baked in a recipe that might call for cookie dough. But that's what happens when you take an exit and place in a place intended for raw ingredients. And you will see the strange behavior. Prepare for these cookies chemically changes them so that cookies already are significantly different from the dough used to create them. Similarly, you don't want to take one or more output files and reuse in a project source.

    So in your case, you run an index file and that fires events to produce the output. All should be well. But when you click on the links to open topics, topics are intended to show up more in the right panel. Think of the picture of how works of image on a TV. The moment that link you to something intended to fill the screen, he is forced into this smaller area on the right. If you end up with what you see in the last picture.

    I suggest the following steps.

    First, REMOVE your resource manager exits.

    REMOVE all links that can point here.

    Output records where people will consume copy your projects. (The web server)

    Then figure either the parent (.. /.. / somefolder/somefile.htm) path to other systems or the absolute path (http://www.whatever.com) and to link the projects in this way.

    Sorry, but without seeing the installation of first hand, it is difficult to say what should be these paths.

    I hope this was helpful... Rick

Maybe you are looking for