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.

Tags: Database

Similar Questions

  • 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...

  • 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.

  • 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;

  • 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 two queries

    Hi friends,

    I use oracle 10g and forms 6i with windows 2008 server

    I have a request two with different where clause.

    I need output like below format

    HEADER IMPORT EXPORT

    TEST 100 400

    Select 'TEST' header, sum (Decode (t.type, 1, amount, amount 3,)) import.

    of sales_dtls t

    where to_char (t.sales_date, 'YYYYMM') = 201309

    and item_code = 1

    Select 'TEST' header, sum (Decode (t.type, 2, amount, amount 4)) export.

    of sales_dtls t

    where to_char (t.sales_date, 'YYYYMM') = 201309

    and item_code = 2

    Rgds

    RDK

    You can post a small example of data as well? (CREATE TABLE and INSERT INTO statements).

    ...

    TO_CHAR (t.sales_date, 'YYYYMM') = 201309

    Oh, and why you compare strings in numbers?

    Always be explicit about the type of data conversions, do:

    TO_NUMBER (to_char (t.Sales_Date, 'YYYYMM')) = 201309

    or

    TO_CHAR (t.sales_date, 'YYYYMM') = '201309'

    Is sales_date column indexed, incidentally?

    Then using a function (TO_CHAR), optimizer will take is more than the index into consideration...

    Not tested, but could be useful to try:

    Select header 'TEST '.

    , sum (decode (t.type | t.item_code, 11, amount))

    31, the amount

    )

    ) import

    , sum (decode (t.type | t.item_code, 22, amount))

    42, sum)

    ) export

    of sales_dtls t

    where to_char (t.sales_date, 'yyyymm') = 201309

    and item_code in (1, 2);

  • My wife and I have laptops and we want to combine the data both on a Mac. Including two Itunes accounts. This is possible by using the migration on each PC asst?

    In what concerns the transfer of data from a PC to a MAC, my wife and I have laptops and we want to combine the data both on a Mac. Including two Itunes accounts. This is possible by using the migration on each PC asst?

    You can bind the whole apple ID using family sharing. If you have trouble doing this, you can go to the apple store, and they would be happy to help you.

  • I try to combine a picture of my sister with a picture of a poem next to her. How to combine the two into a single photo?

    Paint or Windows Photo Gallery

    I try to combine a picture of my sister with a picture of a poem beside it, how to combine the two into a single photo?

    If you have the poem recorded in an image format,
    the following freeware can create a side by side
    Panorama.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Download IrfanView
    http://MajorGeeks.com/IrfanView_d4253.html
    (filename: iview433_setup.exe)
    (uncheck if you don't want Google Chrome)

    Download plug-ins too...

    IrfanView plugins
    http://MajorGeeks.com/IrfanView_PlugIns_d4908.html
    (filename: irfanview_plugins_433_setup.exe)

    When the program is installed... read more...

    Open IrfanView and go... Image / create the Image of the Panorama...
    (this will open the screen to "Create a panorama image")

    On the screen to "Create a panorama image"... left click on the add images"" button.
    (Displays the 'Open' screen. Now, drill down to the
    the folder that contains your saved Photos of veterinarians.

    Now... click left (highlighted), the two images, you want to join.
    (you can select more than one if you hold down your Ctrl key)
     
    The two images highlight... left click on the button 'open '.
    (Or... you can add the images one at a time... which is always easier)

    Now, go back to the screen "Create the panorama image.
    and the file names of the selected pictures need to be in the
    Field "Input Images.

    Now with the names of two files in 'Images of entry' field...
    You can left click on the button 'create Image '.

    (the positions left and right of these images can be swapped in)
    selection of a file name and using the "mount image" / "Move."
    Images down"buttons...)

    Now you should see a display of the combined image.
    Reach... File / save as...

    Choose a backup location / enter a file name / choose a format...
    On the left, click on the button "Save..."

  • combines the two text fields

    Hello, I've created a form with Adobe pro XI. I want to create a text field that combines the two fields (Field1 and Field2) text. How can I do?

    If the third field does not need to be editable, you can use a calculation script customized to what is something like the following:

    Custom calculation script

    (function () {}

    Get the field values as strings

    var s1 = getField("Text1").valueAsString;

    var S2 = getField("Text2").valueAsString;

    Set the value of this field to the concatenation of two strings

    Event.Value = s1 + s2;

    })();

  • I'm trying to move a song to my iPhone music library to the iTunes library on my MacBook Air.  I do not want to synchronize the two, so how do I simply copy/migrate the song on my computer?

    I'm trying to move a song to my iPhone music library to the iTunes library on my MacBook Air.  I do not want to synchronize the two (and they have never been synchronized), so how can I simply copy/migrate the song on my computer?  Is there a way to do, without having to re-purchase the song on the iTunes Store on my Mac?

    E-mail (for yourself) click on it in the email

  • Combine the two columns of text

    I have two columns of text (say that name is a column and the name is the other)

    I would like to combine the two columns for the text of these two columns are in a column. (First name and last name in the same column)

    Is this possible? If so is there a tutorial somewhere?

    Hi Danielle,

    The & (concatenation operator) is your friend.

    Formula in D2 (fill down)

    "B2 &" "& C2.

    & joins elements into a single string.

    "" inserts a space.

    Kind regards

    Ian.

  • Need to combine the two VLOOKUP formulas and SO, tried several variations... not getting what I need.

    Hi, thanks for the review, any help is appreciated.

    The problem.

    I am creating a spreadsheet to download information to a database.

    The database is very picky and all the blank cells cannot contain a zero but should be empty because some cells contain the URL of the image.

    A '0' instead of a string with a .jpg extension will throw an error.

    In general, I use an 'IF' statement to achieve this:

    = IF (A1 = "", "", A1)

    It works like a charm. However, I changed the map and now the cells have a 'VLOOPUP' function to draw the other worksheet data.

    If the target cell has no data the host cell will express a '0 '. This will raise errors on the upload.

    I tried to embed the two formulas without success. Is it possible to combine the two forms, or is there another solution to draw the other worksheet data and if the receiving cell has no data to express an empty cell / VIRGIN instead of a '0 '.

    If you need an example let me know.

    I hope it's clear.

    I suspect this is related to MS Office Excel.  If I'm not mistaken, please repost this in the MS Office category for the version that you are using the category at the top of the page tab
  • I have two script. one for indesign and another for photoshop. How can I combine the two scripts?


    Hi all

    I have a script for indd that convert a table selected user in JPG format (1276 px width, height varies). Second script photoshop asking to select jpg file and then check if the height in pixels is less than 1018 pixel, can he expand canvas size (height) to 1018 px.

    How can I combine the two script, tip, or how to start would be useful? The workflow must be:

    • the user select table in the indd document
    • export table in jpg format
    • script you will be asked to select the file table jpg or if it is possible to automate this would be awesome.
    • enlarge the height of the canvas to 1018 px

    Thank you

    Marie rosine

    PS: I have already read the Java script tool guide pdf but unable to understand

    Yes and the documentation is pretty self-explanatory.

    However, here is an excerpt:

    function callPhotoshop(file) {
       var bt = new BridgeTalk;
    
       bt.target = "photoshop";
    
       bt.body = "function main (){ return confirm('Am I in Photoshop?'); }; main();";
    
      bt.onResult = function(resObj)
      {
      var myResult = resObj.body;
      alert( myResult? "PS code was correctly executed" : "Something wrong happened" );
      }
    
       bt.send();
    }
    
    callPhotoshop();
    

    HTH,

    Loïc

    http://www.ozalto.com

  • How to combine the two fonts in a logo type?

    I've created a customer logo ID, consisting of two fonts. The name of the customer is Trajan Pro. The logo must also include a "Registered" symbol (the circled R) after the name. Unfortunately, using Trajan Pro mode Exhibitor does not look good, especially scaling down and with a circle around the R. To work around this problem, I used the Arial font to create the® in a supplemental box, be able to fine tune its size and position. It's great for once, but I would like to be able to combine the two so that the name of the customer in Trajan Pro and the symbol "Recorded" in Arial can be re-scaling or repositionnes in unison and saved for future use. What is the best way to do it?  Here is an article of the logo to demonstrate what I have:logo+regcircle.jpg

    Select the two text blocks and go to Type > vectorize. Group them. Now that you have drawn, no text. It is usually a good idea to save a logo in a separate file, which can be placed. Put the logo in its own file on one page of appropriate size. Save the file and export a PDF of print quality. Link to the PDF file when using the logo in other files.

  • question about how to combine the two scripts.


    Hello

    I have a sql script that can display a table (or view) all the information, it works fine. I call it validate_table.sql, as below:

    command prompt
    accept invites owner "Enter table owner:
    accept invites from TABLE_NAME "Enter object (table/View...) "name:"


    column owner format a10 column 'owner '.
    column format a30 topic 'Object name' object_name
    column object_type format a15 direction "Type of object".
    Status format a10 column titled "Status".
    in the heading of column created format a20 "created."
    the LAST_DDL_TIME format a20, heading 'LAST_DDL_TIME.
    Select
    owner
    object_name
    object_type
    status
    , to_char (created, "DD_MON_YY hh24:mi:ss") created
    LAST_DDL_TIME,
    Of
    DBA_OBJECTS
    where
    object_name = upper ('& table_name') and owner = upper ('& owner');


    command prompt

    prompt -- ----------------------------------------------------------------------- ---

    Guest - table/view structure-

    prompt -- ----------------------------------------------------------------------- ---

    command prompt


    describe and owner... & table table_name

    command prompt

    prompt -- ----------------------------------------------------------------------- ---

    guest - list assigned user/subsidies-

    prompt -- ----------------------------------------------------------------------- ---

    command prompt

    set pagesize 50000
    set linesize 10000
    set verify off
    Set feedback off
    column lvl format A4 direction "Lvl".
    proprietary format of columns A14
    format column in table_name A29
    A38 dealer column format
    column privilege A10 format


    SELECT 'Role' lvl, t.table_name, t.grantee, t.owner, t.privilege
    OF dba_tab_privs t
    WHERE t.grantee IN (SELECT FROM dba_roles role WHERE = role t.grantee) and t.table_name = upper ('& table_name') and t.owner = upper ('& owner')
    UNION
    SELECT 'User' lvl t.table_name, t.grantee, t.owner, t.privilege
    OF dba_tab_privs t
    WHERE t.grantee IN (SELECT username FROM dba_users WHERE username = t.grantee) and t.table_name = upper ('& table_name') and t.owner = upper ('& owner')
    UNION
    SELECT 'Pub' lvl, t.table_name, t.grantee, t.owner, t.privilege
    OF dba_tab_privs t
    WHERE t.grantee = 'PUBLIC' and t.table_name = upper ('& table_name') and t.owner = upper ('& owner')
    ORDER BY 1, 2, 3;

    command prompt

    prompt -- ----------------------------------------------------------------------- ---

    guest - list of synonyms created.

    prompt -- ----------------------------------------------------------------------- ---

    command prompt


    proprietary format of columns A15
    synonym_name A20 column format
    A15 table_owner column format
    format column in table_name A40
    DB_link A40 column format

    Select the owner, synonym_name, table_owner, table_name, DB_link from DBA_synonyms where Table_name = upper ('& table_name') stopped by the owner;


    command prompt

    prompt -- ----------------------------------------------------------------------- ---

    guest - list index created-

    prompt -- ----------------------------------------------------------------------- ---

    command prompt

    Select
    table-name
    index_name
    index_type
    nom_tablespace
    status
    of DBA_indexes
    WHERE table_name = upper ('& table_name') and owner = upper ('& owner')
    order of table_name, index_name;


    command prompt

    prompt -- ----------------------------------------------------------------------- ---

    guest - list of constraints-

    prompt -- ----------------------------------------------------------------------- ---

    command prompt

    format column in table_name A15
    format of column cons_type A15
    cons_name A20 column format
    check_cons A25 column format
    VALIDATED A20 column format
    column status A10 format
    last_change A20 column format

    Select
    table-name
    (case constraint_type
    When 'P', then 'Primary Key '.
    When 'R' then 'Foreign Key'
    When 'C' then 'check '.
    When 'U' then 'single '.
    When 'o' then 'read only display '.
    When 'V' then 'check the view. "
    When 'H' then 'Hash expression. "
    When 'F' then 'REF column.
    When the of ' then 'additional logging.
    cons_type end)
    constraint_name cons_name
    condition_de_recherche check_cons
    status
    VALID
    last_change
    of dba_constraints
    where owner = upper ('& owner')
    and table_name = upper ('& table_name')
    order of cons_type;

    I have another script that allows to display the newly created tables (table, table names) in the last 24 hours.

    SET SERVEROUTPUT ON;

    DECLARE

    CURSOR tmp_cur IS

    SELECT master, object_name

    FROM dba_objects

    WHERE object_type in ('TABLE', 'SEE') and the owner not in ('SYS', 'SYSTEM', 'GENERAL', "XDB", "OUTLN", "SYSMAN") and last_ddl_time > sysdate - 1;

    tmp_rec tmp_cur % ROWTYPE;

    BEGIN

    FOR tmp_rec IN tmp_cur LOOP

    DBMS_OUTPUT. PUT_LINE)

    tmp_rec. Owner | ' ' || tmp_rec.object_name);

    END LOOP;

    END;

    /

    The gap of the first script (validate_table.sql) is that it can only check table one by one by manual entry, then how can I combine these two scripts, to make a scipt that can check all newly created tables (not a table) in the last 24 hours?

    I thank very you much in advance!

    Hello

    If you already know how to find the owner and all the tables created table_name recently.  One thing you can do is to change all the WHERE clauses in validate_table.sql, so instead of things like

    where object_name = upper ('& table_name') and owner = upper('&owner');

    you say

    WHERE (owner, object_name) IN

    (

    SELECT master, object_name

    FROM dba_objects

    WHERE object_type in ('TABLE', 'SEE')

    AND owner NOT IN ('SYS', 'SYSTEM', 'GENERAL', "XDB", "OUTLN", "SYSMAN")

    AND last_ddl_time > SYSDATE - 1

    )

    ;

    Here is another approach:

    Validate_table. SQL is quite handy as it is.  You may want to run this script for tables, even when you know that they are not new.  Divide into 2 scripts: one called ask_and_describe_table.sql, which looks like this:

    -Ask_and_Describe_Table.sql

    accept invites owner "Enter table owner:

    accept invites from TABLE_NAME "Enter object (table/View...) "name:"

    -You can use any name path instead of d:\some_dir below:

    @d:\some_dir\describe_table & owner, table_name

    and the other one called Describe_Table.sql, which starts like this:

    -Describe_Table.sql

    DEFINE owner = & 1

    DEFINE table_name = & 2

    column owner format a10 column 'owner '.

    ...

    and continues with the same exact content as validate_table.sql.

    Now, to write another script (I'll call it Describe_Recent_Tables.sql):

    -Describe_Recent_Tables.sql - create and run Describe_Many_Tables.sql

    -Turn OFF the devices designed to help people to read the output:

    SET ECHO OFF

    SET FEEDBACK OFF

    SET PAGESIZE 0

    VERRIFY OFF SET

    -Create a Describe_Many_Tables.sql:

    COIL d:\some_dir\describe_many_tables.sql

    SELECT ' @d:\some_dir\describe_table '

    ||      owner

    ||      '  '

    ||      object_name

    FROM dba_objects

    WHERE object_type in ('TABLE', 'SEE')

    AND owner NOT IN ('SYS', 'SYSTEM', 'GENERAL', "XDB", "OUTLN", "SYSMAN")

    AND last_ddl_time > SYSDATE - 1;

    SPOOL OFF

    -Features lighting designed to help people to read the output:

    SET ECHO ON

    SET FEEDBACK ON

    SET PAGESIZE 50

    SET VERRIFY ON

    -Describe_Many_Tables.sql performance

    @d:\some_dir\describe_many_tables

    I guess that all of your tables have standard names (for example, start with a letter, no spaces in the name,...), which don't require quotation marks.  If they could, then the same basic approach will work, but the details are a little messier.

    When you want to see the information on a single table or view, no matter how old it is, driven

    Ask_and_Describe_Table

    or, if you do not need to question the owner of the table and the name, something like

    Describe_Table SCOTT EMP

    (You can find that you really need not Ask_and_Describe_Table.sql).

    When you want to do this for all the tables created in the last 24 hours:

    Describe_Recent_Tables

Maybe you are looking for