combining the three queries into one

Hello everyone, I have the following queries in a format similar to below and I would like to combine it with one... I know I could use an if statement but is it possible to do in pure sql
select t.p1,
       t.p2,
       t.p3,
       t.p4
from tbl_one t
where t.p4 like (p4_parameter)
order by t.p1

select t.p1,
       t.p2,
       t.p3,
       t.p4
from tbl_one t
where upper(t.p1) like upper ((p1_parameter) || '%');

select t.p1,
       t.p2,
       t.p3,
       t.p4
from tbl_one t
where t.p1 != 0;

combine all three queries with GOLD seats...

select t.p1,
       t.p2,
       t.p3,
       t.p4
from tbl_one t
where t.p4 like (p4_parameter)
and upper(t.p1) like upper ((p1_parameter) || '%')
and t.p1 != 0;

and as suggested madhu, while displaying u should take care of type of data as well...

If you want to compare t.p1! = 0
you need to replace

t.P1! = 0 to t.p1! = '0'

or if you want
t.P1! = 0 compared to not null
the

t.P1 is not null

Concerning

UMI

Tags: Database

Similar Questions

  • Combine the two projects into one

    I know it is a very popular question and I read many answers excellent previous answers.  The two most popular procedures seem to be simple copy - paste and use clips of compounds with copy / paste.  CPF has improved this process over the years and I ask the question again to get the benefit of current thinking.   I have an iMac (mid-2011) OS X 10.11.4 and FCP worm 10.2.2.  I have two separate events within the same library.  There is a completed project, with all the transitions, effects and music, located within each discipline.    Current ideas on how to combine these two projects into one would be greatly appreciated.

    Thank you.

    Copy and paste is the only method I know.

    Open the project in the timeline first.

    Open the second project in the timeline panel. Only one project appears at the same time.

    Select an item in the timeline and press command + A to select all, then control + C to copy.

    Use the project navigation arrows to return the first project:

    Move the playhead to where copied clips must be glued and press command + V.

    Al

  • How to combine the two queries into a single

    Hi gurus,

    SQL > select * from v version $;

    BANNER

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

    Oracle Database 10g Release 10.2.0.4.0 - Production 64-bit

    PL/SQL Release 10.2.0.4.0 - Production

    CORE 10.2.0.4.0 Production

    AMT for Linux: release 10.2.0.4.0 - Production

    NLSRTL Version 10.2.0.4.0 - Production

    SQL >

    I have following two queries. How can I convert these two queries into one with the same result?

    1ST QUARTER

    SELECT id, $vdate, SupplierName, venddate, vid

    THE SELLER

    WHERE processid = 32

    AND venddate is null

    AND vid to (select vid from view_vid where type = 'PDX')

    AND (id, $vdate) not in (select id, $vdate from vkfl_is where task_id = 55)

    AND (id, $vdate) in (select id, vidate from market_data where marketed_date is null)

    AND id not in (select id from location)

    Q2

    SELECT id, $vdate, SupplierName, venddate, vid

    THE SELLER

    WHERE processid = 20

    AND venddate is null

    AND vid to (select vid from view_vid where type = 'PBX')

    AND (id, $vdate) not in (select id, $vdate from vkfl_is where task_id = 40)

    AND (id, $vdate) in (select id, vidate from market_data where region_date is null)

    AND id not in (select id from location)

    I can the UNION queries these two, but is there some way I can write a single query that gives me the same result as above two queries?

    Any help would be much appreciated

    Thanks in advance

    Sorry, it lack

    SELECT id, $vdate, SupplierName, venddate, vid

    THE SELLER

    ProcessID WHERE in (32.20)

    AND venddate is null

    AND vid to (select vid from view_vid where type = case when processid = 32

    then "PDX".

    else "PBX".

    end)

    AND (id, $vdate) not in (select id, $vdate from vkfl_is where task_id = case when processid = 32

    then 55

    40 else

    end)

    AND (id, $vdate) in (select id, vidate from market_data cases where processid = 32)

    then marketed_date

    of other region_date

    end to the null value

    )

    AND id not in (select id from location)

    Concerning

    Etbin

  • Combine the three columns into a single

    Hello

    We have a hierarchy of dimension organization at three levels: company-> Group-> business units operating... each with a total of actual AMAURY. (Business Units drive business groups and business groups roll in society)

    I want to display the data for the amounts of the CDA in a simple table report but I need to have the name of the entity (company, group operating Business Unit) doesn't appear in the same column, only not as a hierarchy.

    Example:

    Company $1-6500
    Working Group 1-2 $500
    Business Unit 1-$1000
    Business Unit 2-$1500
    Group 2-$4000
    Business Unit 3-$3000
    Business Unit 4-$1000

    Is this possible?

    TIA,
    Ash.

    A possible solution: you have to do four-speed with two columns.

    One for the company
    One for the Business unit
    One group of operation

    And the other to a Union of the first three reports.
    And you need to add a column to sort (hierarchy pesudo) If you want to see the values in the correct order.

  • I currently have a creative cloud with an e-mail account, however I have a behance with an e-mail account that I have had for many years (even Adobe and Behance made before part of the same group). Can I combine these two accounts into one?

    I currently have a creative cloud with an e-mail account, however I have a behance with an e-mail account that I have had for many years (even Adobe and Behance made before part of the same group). Can I combine these two accounts into one? I want to use the account that I pay cloud Creative if I can use the new portfolio feature.

    Thank you.

    This is an open forum, not Adobe support... below to connect with Adobe personnel to help

    While the forums are open 24/7 you can't contact Adobe support at any time

    Chat support: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    Don't forget to stay signed with your Adobe ID before accessing the link below

    Creative cloud support (all creative cloud customer service problems)

    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

  • Is it possible to find the two sentences into one pdf file? For example, I know the words 'Here' and 'the answer' occur more than once in my document, but only once on the same page. I'm looking for this page.

    Is it possible to find the two sentences into one pdf file? For example, I know the words 'Here' and 'the answer' occur more than once in my document, but only once on the same page. I'm looking for this page.

    I tried to do this by using the search but it will find only them, if they occur as a long chain, that is to say "Here's the answer" rather than how they occur in the document it is to say "Here 's" a bunch of information that leads you to 'the answer'. The search feature so standard did not help.

    Then I tried to do this by using the tool to delete (obviously not the application of writing!) because it allows me to search for multiple words or phrases, however it is not highlight what page both are found. I tried to turn on the preference to enable deletions of comments and even if it meant that I could then go through all the comments, it's still not faster than my document is more than 1,000 pages, which meant there were too many total comments for me to be able to easily identify which page had both.

    Any ideas?

    There is no built-in way to search for two strings and limited to show only the results that appear on the same page.

    It can be done by using a custom script, however.

  • Want to combine the two queries

    Hello

    It is my first post here, I hope it's a good place to put it.

    I have two queries that both gave me the results. I guess that both are way more elegant or better to do what they do, but that's what I came with. So feel free to modify them. However, my real problem is I want to combine these two queries in a single query, removing duplicate information.

    analytical_query

    SELECT * from(
      select
      requisitions.acc_id AS "Accession #"
      ,requisitions.draw_date AS "Draw Date"
      ,requisitions.received_date AS "Received Date"
      ,req_panels.run_date AS "Run Date"
      ,tests.TEST_ID
      ,(CASE WHEN tests.TEST_ID IN (7101) THEN results.RESULT_NUMERIC*2
             ELSE results.RESULT_NUMERIC
       END) AS RESULT_NUMERIC
      ,doctors.f_name || ' '|| doctors.l_name AS "Physician"
      ,organizations.state AS "State"
    FROM requisitions
    
    inner join req_panels ON requisitions.acc_id = req_panels.acc_id
    inner join results ON req_panels.rp_id = results.rp_id
    inner join tests ON results.test_id = tests.test_id
    inner join doctors ON requisitions.doc_id1 = doctors.doc_id
    inner join organizations ON requisitions.org_id = organizations.org_id
    
    WHERE requisitions.DEL_FLAG='F'
         AND req_panels.DEL_FLAG='F'
         AND results.DEL_FLAG='F'
         AND req_panels.PANEL_ID IN (7000,70001,70551)
         AND results.TEST_ID IN (7101,7102,7107,7108)
         AND requisitions.RECEIVED_DATE > TO_DATE('9/1/2013', 'MM/DD/YYYY')
    ORDER BY requisitions.ACC_ID
    )
    
    pivot(
          MAX(RESULT_NUMERIC)
          for TEST_ID IN ('7101' AS CRP,'7102' AS Hemoglobin,'7107' AS "LDT Run 1",'7108' AS "LDT RUN 2")
    )
    

    culture_query

    SELECT * from(
    select
      requisitions.acc_id AS "Accession #"
      ,MAX(requisitions.draw_date) AS "Draw Date"
      ,MAX(requisitions.received_date) AS "Received Date"
      ,MAX(req_panels.run_date) AS "Run Date"
      ,tests.TEST_ID
      ,LISTAGG(results.RESULT_ALPHA, ';')
      WITHIN GROUP
      (ORDER BY results.RESULT_ALPHA) RESULT_ALPHA
    FROM requisitions
    
    inner join req_panels ON requisitions.acc_id = req_panels.acc_id
    inner join results ON req_panels.rp_id = results.rp_id
    inner join tests ON results.test_id = tests.test_id
    inner join doctors ON requisitions.doc_id1 = doctors.doc_id
    inner join organizations ON requisitions.org_id = organizations.org_id
    
    WHERE req_panels.PANEL_ID IN (7000,70001,70551)
         AND results.TEST_ID IN (10010,10052,11010)
         AND requisitions.RECEIVED_DATE > TO_DATE('9/1/2013', 'MM/DD/YYYY')
         AND requisitions.DEL_FLAG = 'F'
         AND req_panels.DEL_FLAG = 'F'
         AND results.DEL_FLAG = 'F'
         AND req_panels.RUN_DATE is not null
    group by requisitions.ACC_ID, tests.TEST_ID
    )
    
    pivot(
          MAX(RESULT_ALPHA)
          for TEST_ID IN ('10010' AS "Organism",'10052' AS "Negative/No Growth", '11010' AS "Growth")
    )
    

    Basically, what is missing from the first query is the global list of the 'RESULT_ALPHA' for 'TEST_ID"10010, 10052 and 11010 numbers. And because of the way they want to view this information that I had to tilt it, which is where I ran into problems. If anyone has any idea on how I can combine these two requests and make them more effective that would be great.

    Thank you.

    Hello

    JayG30 wrote:

    ... I have however found a way to do what I would call "swivel conditional."  ...

    I think it's the crux of this problem; you want MAX BOF a few tests and LISTAGG for others.  I don't know a good way to attract the SELECT... PIVOT to do both at the same time.  I think it's one of those situations where SOME... PIVOT is not the best tool for the job;  MAX (CASE...) and LISTAGG (CASE...) may be more practical and more effective:

    SELECT rq.acc_id

    , MAX (rq.draw_date) AS "the draw Date.

    , MAX (rq.received_date) as BEING "received Date".

    , MAX (rp.run_date) AS "Date of the race.

    , MAX (CASE WHEN rs.test_id = 7101 THEN rs.result_numeric * END 2) AS the crp

    , MAX (CASE WHEN rs.test_id = 7102 THEN rs.result_numeric END) AS hemoglobin

    , MAX (CASE WHEN rs.test_id = 7107 THEN rs.result_numeric END) AS "LDT Run 1.

    , MAX (CASE WHEN rs.test_id = 7108 THEN rs.result_numeric END) AS "LDT, 2nd round.

    , LISTAGG (CASE WHEN rs.test_id = 10010 THEN rs.result_alpha END)

    , ';'

    ) Within GROUP (ORDER BY rs.result_alpha) AS "organization".

    , LISTAGG (CASE WHEN rs.test_id = 11010 THEN rs.result_alpha END)

    , ';'

    ) Within GROUP (ORDER BY rs.result_alpha) AS a 'growth '.

    , LISTAGG (CASE WHEN rs.test_id = 10052 THEN rs.result_alpha END)

    , ';'

    ) Within GROUP (ORDER BY rs.result_alpha) AS 'Negative/No growth '.

    Rq requisitions

    INNER JOIN req_panels ON rp.acc_id = rq.acc_id PR

    INNER JOIN results rs ON rs.rp_id = rp.rp_id

    WHERE rq.del_flag = 'F'

    AND rp.del_flag = 'F'

    AND rs.del_flag = 'F'

    AND rp.run_date IS NOT NULL

    GROUP BY rq.acc_id

    ORDER BY rq.acc_id

    ;

    I don't quite get the results you have posted; for example, I don't see how you get a row of results with 'Accession' = 142425, while acc_id does not occur in the sample data.  It was maybe just a typo.

  • combine the two queries analysis

    Hi friends,

    could you please help me to combine these two queries. The bottom one looks like, take too many resources.

    FUNCTION XML_error_log ()P_i_xml IN XMLTYPE, p_i_event_key IN VARCHAR2,( )

    RETURN VARCHAR2

    IS

    l_covered_product_header_id NUMBER ;

    l_item_path VARCHAR2 (500);

       xml_table                     XMLTYPE;

    p_ret_code_o VARCHAR2 (5);

    p_error_buff_o VARCHAR2 (2000);

       l_user_id                     NUMBER (15) := fnd_global . user_id ;

    l_implicit_product_name VARCHAR2 (40);

    l_top_model_line_id oe_order_lines_all . top_model_line_id % TYPE;

    main_error_check VARCHAR2 (100) := NULL;

    main_error_check1 VARCHAR2 (100) := NULL;

    l_status_log_status VARCHAR2 (1);

    l_err_msg_log_status VARCHAR2 (4000);

       p_o_status                    VARCHAR2 (100);

       p_o_err_msg                   VARCHAR2 (100);

    P_i_input_res_xml XMLTYPE;

    BEGIN

    p_o_status := 'S' ;

    p_o_err_msg := NULL;

    Dbms_output.put_line ()' Start... process_response_xml ');

    FOR i

    IN (SELECT x. code , x . gravity , x . Description                   

    DE XMLTABLE ( )

    xmlnamespaces (DEFAULT ' urn: xyz:ccw:config:common: data'()

    , ' for $i in //error

    Returns the element r {}

    $i / code,.

    $i / description.

    $i / gravity

    }'

    By the WAY P_i_input_res_xml

    COLUMNS

                  code  VARCHAR2 (13) Path 'code'

    , gravity VARCHAR2 (30) Path "gravity"

    , Description VARCHAR2 (30) Path 'description'

    ) x )

    LOOP

    DBMS_OUTPUT.put_line ) ( )

    ' code : ' || i . code );

    DBMS_OUTPUT.put_line ) ( )

    ' severity: ' || i . gravity );

    DBMS_OUTPUT.put_line ) ( )

    ' description: ' || i . Description );

    main_error_check := i . code of : main_error_check;

    INSERT IN xxgco_config_validate ()event_status ERROR_CODE error_description ,error_severity creation_date event_key last_update_date( )

    VALUES('E',i. code , i . Description , i . gravity SYSDATE, p_i_event_key , SYSDATE);

    RETURN 'E' ;

    END LOOP;

    DBMS_OUTPUT.put_line ()' main_error_check:' : main_error_check);

    DBMS_OUTPUT.put_line ()' COMPLETED:');

    IF main_error_check IS NULL

    THEN

    FOR i

    IN (SELECT x. code , x . gravity , x . Description , x . subcause                   

    DE XMLTABLE ( )

    xmlnamespaces (DEFAULT ' urn: xyz:ccw:config:common: data'()

    , ' for $i in //message

    Returns the element r {}

    $i / code,.

    $i / description.

    $i / gravity,.

    $i / subCause

    }'

    By the WAY P_i_input_res_xml

    COLUMNS

                  code  VARCHAR2 (13) Path 'code'

    , gravity VARCHAR2 (30) Path "gravity"

    , Description VARCHAR2 (30) Path 'description'

    , subCause VARCHAR2 (50) Path "subCause"

    ) x )

    LOOP

    DBMS_OUTPUT.put_line ) ( )

    "code:" || i . code );

    DBMS_OUTPUT.put_line ) ( )

    ' severity: ' || i . gravity );

    DBMS_OUTPUT.put_line ) ( )

    ' description: ' || i . Description );

    DBMS_OUTPUT.put_line()' subCause:': i. subCause );

    INSERT IN xxgco_config_validate ()event_status ERROR_CODE error_description ,error_severity error_cause creation_date event_key last_update_date( )

                        VALUES('E',i. code , i . Description , i . gravity , i . subcause SYSDATE, p_i_event_key , SYSDATE);

    main_error_check1 := i . code of : main_error_check1;

    END LOOP;

    IF main_error_check1 IS NOT NULL

    THEN

    RETURN ('E');

    ON THE OTHER

    RETURN ('S');

    END IF;

    ON THE OTHER

    -TODO Log main error Log

    RETURN ('E');

    END IF;

    EXCEPTION

    WHEN Others

    THEN

    p_o_err_msg :=

    SUBSTR (

    ' Error in the response_XML_error_log FUNCTION:'

                || SUBSTR (SQLERRM, 1, 250)

                || ':'

                || DBMS_UTILITY.format_error_backtrace ,

    1 ,

    4000 );

    RETURN 'E' ;

    END XML_error_log ;



    Thanks in advance

    Ok.. This isn't a constructive debate...

  • Merge two threads in the same person into one iMessage

    I know that this issue has been addressed before. Most importantly, the discussion was on did not understand what the problem is.

    So let me try to explain.

    Tarzan has an iPhone and an iMac, Jane also has an ios device.

    When Tarzan Jane sends an iMessage with his iPhone, Jane receives from "Tarzan" (the iMessage was related to his phone number)

    Now, when Tarzan sends Jane an iMessage of its iMac, Jane receives from "Tarzan", but in a separate thread. (This iMessage was related to his email address)

    Now Jane is in danger and she wants Tarzan to rescue her, she grabs his iPhone, opens the last conversation with Tarzan and Tarzan 'Help texts

    But Tarzan in the jungle and he has only his iPhone with him.

    Jane get killed because the imessage is sent to the iMac of Tarzan and not to his iPhone.

    ====

    The problem is, you get two threads in the same person, are sent to the e-mail address associated with the iMessage, one for the phone number.  But you can't see the difference between the two (except when you dig deep into the background-info).

    If my suggestion of Apple is, they appreciate Jane's life, fix this problem soon: merge those two threads into one.

    PeterSmith wrote:

    I know that this issue has been addressed before. Most importantly, the discussion was on did not understand what the problem is.

    So let me try to explain.

    Tarzan has an iPhone and an iMac, Jane also has an ios device.

    When Tarzan Jane sends an iMessage with his iPhone, Jane receives from "Tarzan" (the iMessage was related to his phone number)

    Now, when Tarzan sends Jane an iMessage of its iMac, Jane receives from "Tarzan", but in a separate thread. (This iMessage was related to his email address)

    Now Jane is in danger and she wants Tarzan to rescue her, she grabs his iPhone, opens the last conversation with Tarzan and Tarzan 'Help texts

    But Tarzan in the jungle and he has only his iPhone with him.

    Jane get killed because the imessage is sent to the iMac of Tarzan and not to his iPhone.

    ====

    The problem is, you get two threads in the same person, are sent to the e-mail address associated with the iMessage, one for the phone number.  But you can't see the difference between the two (except when you dig deep into the background-info).

    If my suggestion of Apple is, they appreciate Jane's life, fix this problem soon: merge those two threads into one.

    IMessage works as it should.

    There is also no apple here to read your thread in this forum for a user to.

    You can send your comments here http://www.apple.com/feedback/

    If Jane was smart it would always send you an imessage using your phone number and not apple id.  Here again, you can add your apple ID to imessage on your phone.

  • How can I combine the two videos in one video in iTunes?

    I was wondering how can I merge two videos into one on iTunes. I don't know how I can merge. Can you please show me how to merge the videos so I can add the video to my iPod? Thank you

    iTunes can connect two videos. iMovie for iOS on iPod touch may be able to do it for you according to the format. Otherwise, there is a sequel called FreeStudio which probably has a tool for the job.

    TT2

  • How to combine two different accounts into one?

    We have an account at work that has a subscription of cloud on that and I also have a separate for work as I can access only. How am I supposed to combine the two is multi-user account? My account has expired so I need re-new anyway with the other one.

    Help, please!

    Since this is an open forum, not Adobe support... you must contact Adobe personnel to help

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    Don't forget to stay signed with your Adobe ID before accessing the link below

    Creative cloud support (all creative cloud customer service problems)

    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

    For a computer to work, you may need a TEAM account

    - https://creative.adobe.com/plans?plan=team team plans

    -http://www.adobe.com/creativecloud/buy/business.html

    -https://helpx.adobe.com/contact/creative-cloud-teams.html using the team

    -manage your account http://forums.adobe.com/thread/1460939?tstart=0 team

  • How can I transfer my address book from Thunderbird to another running Thunderbird computer and combine the old and the new list into one?

    I have a computer in my summer residence and one to my winter home. They both run Thunderbird for my emails. When I move one residence for others, I want to update my address book Thunderbird. I do it by selecting - address book - tools - export, on the ' old computer ', store them on a memory stick, and paste _ address book - tools - import, the new address to load the list from memory. It works, except that the address of old and new lists are separate lists. I would like to combine them, but without the duplication of the same addresses. Is this possible? How can I do this?

    http://KB.mozillazine.org/Moving_address_books_between_profiles
    http://forums.mozillazine.org/viewtopic.php?f=28 & t = 1588535

  • Help to combine the two queries with dependencies

    Combining two queries with dependencies:
    First ask: Returns USER_ID that has a type of access to a table with the OWNER (I also shoot the TLA of the USER_ID standard: ' of TLA #)

    Select distinct SUBSTR (DBA_USERS. Username, 2, 3) AS TLA

    DBA_USERS. Username USED_ID

    DBA_TAB_PRIVS. Owner OWNER

    from DBA_USERS

    DBA_ROLE_PRIVS

    DBA_TAB_PRIVS

    where DBA_USERS. Username = DBA_ROLE_PRIVS. Dealer

    and DBA_USERS.default_tablespace not in ('SYSTEM', "SYSAUX")

    and DBA_USERS. Username like would be %'

    and DBA_ROLE_PRIVS. Granted_role = DBA_TAB_PRIVS. Dealer

    and SUBSTR (DBA_USERS. Username, 2, 3) <>DBA_TAB_PRIVS. Owner

    ;

    Example of results (red font used in the last citation):

    TLA USED_ID OWNER

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

    DGTX999 GTX GRR

    DGTX999 GTX ABG

    DGTX999 GTX HTC

    FWS DFWS999 GRR

    OCN DOCN999 GRR

    RHR DRHR999 DAS

    ETM DETM999 DAS

    FWS DFWS995 DAS

    CD DCDS999 DAS

    ABE DABE999 DAS



    Second request: matches the USER name (same standards as above) and MACHINES (filter PC connections) and the number of connections made of

    Select DBA_USERS. Username

    DBA_HIST_ACTIVE_SESS_HISTORY. Machine

    COUNT (*) AS CONN_COUNT

    of DBA_HIST_ACTIVE_SESS_HISTORY

    DBA_USERS

    where DBA_HIST_ACTIVE_SESS_HISTORY. User_id = DBA_USERS. User_id

    and DBA_USERS. Username like would be %'

    and DBA_HIST_ACTIVE_SESS_HISTORY. Machine not as "WINAD%\%-%".

    Group of DBA_USERS. Username

    DBA_HIST_ACTIVE_SESS_HISTORY. Machine

    order by 1

    3 desc;

    Example of results (red font used in the last citation):

    MACHINE CONN_COUNT USERNAME

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

    DFWS999 home13e0 7557

    DGAM800 vu1246 37

    DGAM999 vu1246 2558

    DABE999 back18cb 4639

    DINL888 home162f 84

    DFWS999 WINDAD\OMHQ58BF 178

    DCDS999 back18cb 788

    DGTX999 home18c8 7

    DGTX999 home13d3 62

    DOCN999 vu1261 44

    DFWS999 back1976 3

    DCDS999 home18c8 173

    DGTX999 home19c9 13

    What I'd like to have (just made two first USER_IDs from the first query) (COL duplicated for each separate owner 1-4).  So 3 machines and 3 owners would result in 9 lines (I could reorganize the collar and use a 'pause'):

    TLA USED_ID MACHINE CONN_COUNT OWNER

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

    GTX DGTX999 home13d3 62 GRR

    Home18c8 GTX DGTX999 7 GRR

    DGTX999 GTX home19c9 GRR 6

    GTX DGTX999 home13d3 62 ABG

    DGTX999 GTX home18c8 ABG 7

    DGTX999 GTX home19c9 6 GBS

    GTX DGTX999 home13d3 62 CTH

    DGTX999 GTX HTC 7 home18c8

    DGTX999 GTX home19c9 6 HTC

    FWS DFWS999 home13e0 7557 GRR

    FWS DFWS999 WINDAD\OMHQ58BF 178 GRR

    FWS DFWS999 back1976 GRR 3


    So it would be logically read: TLA as USER_ID of MACHINE, CONN_COUNT consultation times: OWNER information.

    Thought as only those with the necessary values. Just try this and let me know in the case of all conflicts in the output.

    WITH T1 AS)

    Select distinct SUBSTR (DBA_USERS. Username, 2, 3) AS TLA

    DBA_USERS. Username USED_ID

    DBA_TAB_PRIVS. Owner OWNER

    ROWNUM RN

    from DBA_USERS

    DBA_ROLE_PRIVS

    DBA_TAB_PRIVS

    where DBA_USERS. Username = DBA_ROLE_PRIVS. Dealer

    and DBA_USERS.default_tablespace not in ('SYSTEM', "SYSAUX")

    and DBA_USERS. Username like would be %'

    and DBA_ROLE_PRIVS. Granted_role = DBA_TAB_PRIVS. Dealer

    and SUBSTR (DBA_USERS. Username, 2, 3) <> DBA_TAB_PRIVS. Owner),

    () AS T2

    Select DBA_USERS. Username

    DBA_HIST_ACTIVE_SESS_HISTORY. Machine

    COUNT (*) AS CONN_COUNT

    of DBA_HIST_ACTIVE_SESS_HISTORY

    DBA_USERS

    where DBA_HIST_ACTIVE_SESS_HISTORY. User_id = DBA_USERS. User_id

    and DBA_USERS. Username like would be %'

    and DBA_HIST_ACTIVE_SESS_HISTORY. Machine not as "WINAD%\%-%".

    Group of DBA_USERS. Username

    DBA_HIST_ACTIVE_SESS_HISTORY. Machine

    order by 1

    3 desc)

    SELECT T1. TLA

    ,         T1. USED_ID

    ,         T2. MACHINE

    ,         T2. CONN_COUNT

    ,         T1. OWNER

    FROM T1

    T2

    WHERE T1. USED_ID = T2. USER NAME;

  • Fusion of the 2 lines into one

    Greedings,

    I have the following output
            
    1       A       null     null
    
    2      null      B         C
    How is it possible to merge in one line?
    CREATE TABLE test_g 
    (
    a VARCHAR2(1),
    b VARCHAR2(1),
    c VARCHAR2(1)
    )
    INSERT INTO test_g 
    VALUES (null,'B','C');
    
    INSERT INTO test_g 
    VALUES ('A',null,null);

    You could do this:

    SELECT MAX(a),
           MAX(b),
           MAX(c)
    FROM   test_g
    
  • Try to combine the two queries

    I have two queries of tables in which I combine and summarize the results in a single value. Could someone let me know what it is that im missing here? Thank you

    Deanna

    Output current:

    SUM
    5
    10

    The output I want to see:
    SUM
    15


    My paintings:

    TABLE 'CHART '.
    CASE_NUMBER - VARCHAR2
    PER_INV_FATALITIES - NUMBER (5.0)
    ASSIGNEDDATE_CHART - DATE

    TABLE "VEHICLES".
    CASE_NUMBER - VARCHAR2
    VEHICLE_FATALITY #-NUMBER (5.0)



    Current SQL query:
    SELECT SUM(ct) FROM (
    SELECT SUM(vehicle_fatality#) ct FROM vehicles inner join chart
    on vehicles.case_number=chart.case_number
    WHERE vehicle_fatality#>=1 AND 
    ASSIGNEDDATE_CHART BETWEEN TO_CHAR(TRUNC(SYSDATE,'RR'),'DD/MON/RR')AND SYSDATE)
    union all
    SELECT SUM(ct) FROM (
    SELECT SUM(per_inv_fatalities) ct FROM chart
    WHERE PER_INV_FATALITIES>=1 AND 
    ASSIGNEDDATE_CHART BETWEEN TO_CHAR(TRUNC(SYSDATE,'RR'),'DD/MON/RR')AND SYSDATE);

    Hello

    Instead of:

    SELECT  SUM (ct)
    FROM     (query_a)
    UNION ALL
    SELECT  SUM (ct)
    FROM     (query_b)
    ;
    

    do

    SELECT     SUM (ct)
    FROM     (          query_a
         UNION ALL     query_b
         )
    ;
    

    SUM without GROUP BY will produce a line.
    If you do a UNION ALL of two queries of this type operation, you will get two rows.
    The UNION ALL first, then make a single SUM on the combined results.

Maybe you are looking for

  • ThorLabs DET10A connection in coupling AC 50 ohms digitizer

    Hello I'm scanning the signal of a ThorLabs DET10A using an adaptation NI 5772 AC FlexRIO Module.  The DET10A is 50 ohms and the 5772 is 50 ohms, but a direct link between the two does not work.  I expect pulse height N and width M, where N is the or

  • 2012R2 WindowsServer Seach Index crashes

    Hello! I have a Dell PET620 running Windows Server 2012 R2 Standard. Have been installing the server for about 8 months now and the only question that went unresolved, is that the search Index crashes. When he does this customers cannot use options t

  • My hotmail account is temporarily blocked.

    I changed email addresses and now my account is temporarily blocked after sending of new address to my contacts list. I have to send the mobile phone for a code number to unlock.  My cell phone does not accept the mnessages of text they send. The Hel

  • C:\users\andy\appdata\local\ucenonuci.dll

    Hi, I got a Trojan horse on my computer I paid the tariff to remove, which they did, had 2 attempts. Now when I start my computer my homepage of Andy Office area with (C:\users\andy\appdata\local\ucenonuci.dll) that displays on this subject. I tried

  • Trusting security alerts

    I had a previous problem with the fake Security Essentials 2010 and fortunately got rid of him.  However, my pc seems to be under the constant virus attack when I'm on the internet and I'm not sure I can trust the warnings.  (I won't be screwed again