Merge two query results

Is it possible to merge 2 query results?

I have a function that returns a querey result.

< CFSET Temp = query1 >
< CFSET FNCTransfers = temp >

Now I want to change the query to return a query result merged

< CFSET Temp = query1 >
< CFSET temp2 = query2 >

Is it possible to merge two results?

Something like that (I know it cannot be like that)
< CFSET FNCTransfers = temp1 & temp2 >

Maby there should be a union and query of query?


The UNION could be the way to go. the results of the query must match
between 2 requests (the types must match for two field data queries)


SELECT * FROM query1
UNION
SELECT * FROM query2

Kruse says:
> Is it possible to merge 2 query results?
>
> I have a function that returns a querey result.
>
>< cfset="" temp="query1">
>
>
> Now I want to change the query to return a query result merged
>
>< cfset="" temp="query1">
>
>
> Is it possible to merge two results?
>
> Something like that (I know it cannot be like that)
>
>
> Maby there should be a union and query of query?
>

Tags: ColdFusion

Similar Questions

  • Faced with the question all by merging two variable result sets in BPEL 2.0

    I am facing problem while merging the response of the two variables (operations and list of objects) in BPEL 2.0

    My code snippet is as below:

    <assign name="AssignJobList">
      
    <extensionAssignOperation>
      
    <bpelx:copyList>
      
    <bpelx:from>$InvokeJobDetailsPSGetUpdatedJobObjectsResponse.JobProxyResponse/sfabmabo:Job</bpelx:from>
      
    <bpelx:to>$MergeJobListResponseMessage.JobProxyResponse/sfabmabo:Job</bpelx:to>
      
    </bpelx:copyList>
      
    <bpelx:insertAfter>
      
    <bpelx:from>$InvokeJobDetailsPSGetEffectiveJobObjectsResponse.JobProxyResponse/sfabmabo:Job</bpelx:from>
      
    <bpelx:to>$MergeJobListResponseMessage.JobProxyResponse/sfabmabo:Job[last()]  </bpelx:to>
      
    </bpelx:insertAfter>
     
    </extensionAssignOperation>
    </assign>


    For CopyList operation, its updates the target variable but for the insert after operation on its merger nor her raise an error.

    Could you please help me in the same.

    Thank you

    Hello

    The above problem can be solved by adding a tag for each operation of bpelx as shown below:

    $InvokeJobDetailsPSGetUpdatedJobObjectsResponse.JobProxyResponse / sfabmabo:Job

    $MergeJobListResponseMessage.JobProxyResponse / sfabmabo:Job

    $InvokeJobDetailsPSGetEffectiveJobObjectsResponse.JobProxyResponse / sfabmabo:Job

    $MergeJobListResponseMessage.JobProxyResponse / sfabmabo:Job [last ()]

    Kind regards

  • How to merge two partitions in XP

    I have Windows XP Service Pack 3.

    The space becomes very low on my NTFS Partition that contains Windows XP. There are partition with more than 100 GB of free space I want to access — preferably by merging two partitions or not not to resize the NTFS partition.
    From Googling, it seems that I cannot use the native Windows XP and need a third party application software, but I see that's not without risk of data loss.
    Can someone advise please?  Ty.

    6. as a result, select your C: drive and the option "Extend Volume". Your computer will automatically select the empty spaces available on your hard drive and you can change them if you want to do.

    This desire. Not. Work. for system volumes or boot or a partition on which the pagefile system is located.

    In addition, the GUI (using the disk management) method only works with volumes 'simple' or 'split', which are forms of "Dynamics" volumes and volumes of"base" that most of the people have set up.  http://support.Microsoft.com/kb/314343

    Given that the OP asked about the increase in the size of the partition system (my Partition NTFS which contains Windows XP) which is probably also the boot partition as where the pagefile, the posting is irrelevant.

    For Andrew pieces:

    Here are a few options in alphabetical order:

    Acronis Disk Director
    EASEUS Partition Manager free
    O & O Partition Manager 3

    Paragon Partition Manager

  • Need help to understand the query result

    Hi gurus

    I was reading one of the question here in this forum and its link is below:

    Query required for scenario

    I had some confusion related to this code and don't understand the logic of the out put, see query below:

    Query

    with sub_services as

    (

    Select su_seq 12323, 'HLR1' so_id, 1 seq Union double all the

    Select su_seq 12323, "HLR2' so_id, seq 2 Union double all the

    Select su_seq 12323, "A09" so_id, seq 3 of all the double union

    Select su_seq 12333, "MO1" so_id, seq 4 Union double all the

    Select su_seq 12333, "MO2' so_id, seq 5 Union double all the

    Select su_seq 12333, "A09" so_id, 6 seq in union double all the

    Select su_seq 12333, 'M0CR' so_id, seq 7 Union double all the

    Select su_seq 12999, "LOL1' so_id, seq 8 Union double all the

    Select su_seq 12999, "LOL2' so_id, seq 9 double

    )

    Select *.

    of sub_services b

    where exists (select 1 from sub_services

    where su_seq = b.su_seq

    and so_id = 'A09.

    )

    order by 2;

    The query result

    12323 A09 3

    12333 6 A09

    12323 HLR1 1

    12323 HLR2 2

    12333 M0CR 7

    12333 4 MO1

    12333 5 MO2

    According to my understanding, the above query should return records in red only because of her is below command

    It exists (select 1 from sub_services

    where su_seq = b.su_seq

    and so_id = 'A09.

    but don't know why he's back 7 files, can someone help me understand the result...

    It is query is functionally identical to the PL/SQL block, but much more effective.

    declare

    number of l_res;

    Start

    for line (select *)

    sub_services) loop

    Start

    Select 1 from l_res

    of sub_services

    where su_seq = row.su_seq and

    so_id = "A09" and

    rownum = 1;

    exception when

    NO_DATA_FOUND then

    null;

    end;

    end loop;

    end;

    Essentially every row in the outer query are tested against him exists query.  Given the correlation between two requests is based only on su_seq each line with a su_seq value returned by him is returned in the output.

    Another way to think he uses instead a join condition.  This query is equivalent to the query to exist

    Select the main

    of main sub_services

    Join select (separate su_seq

    of sub_services

    where so_id = "A09") cond

    We main.su_seq = cond.su_seq;

    John

  • Duplicates in hierarchical query results

    Please use the suite of applications:

    CREATE TABLE EMP

    (NUMBER OF EMP_ID,

    EMP_NAME VARCHAR2 (50).

    NUMBER OF MANAGER_ID

    );

    INSERT INTO EMP VALUES(1,'SCOTT',);

    INSERT INTO EMP VALUES(2,'JOHN',1);

    INSERT INTO EMP VALUES(3,'ROB',2);

    INSERT INTO EMP VALUES(4,'MIKE',2);

    INSERT INTO EMP VALUES(5,'BOB',);

    INSERT INTO EMP VALUES(6,'JEFF',5);

    COMMIT;

    SELECT * FROM EMP, (SELECT EMP_ID FROM EMP WHERE EMP_ID IN (1.5)) TEMP

    START BY EMP. EMP_ID = TEMP. EMP_ID

    CONNECT BY PRIOR EMP. EMP_ID = EMP. MANAGER_ID;

    Basically, I first spend a few emp_ids a subquery and then want to see all records in the table emp which are direct or indirect of those emp_ids children.

    But I get a lot of duplicate records. Can someone explain what is the reason behind this? I can use SEPARATE and spend, but there could be a problem with my request in the first place.

    Help, please!

    Thank you

    RN

    Hello

    RN says:

    Please use the suite of applications:

    CREATE TABLE EMP

    (NUMBER OF EMP_ID,

    EMP_NAME VARCHAR2 (50).

    NUMBER OF MANAGER_ID

    );

    INSERT INTO EMP VALUES(1,'SCOTT',);

    INSERT INTO EMP VALUES(2,'JOHN',1);

    INSERT INTO EMP VALUES(3,'ROB',2);

    INSERT INTO EMP VALUES(4,'MIKE',2);

    INSERT INTO EMP VALUES(5,'BOB',);

    INSERT INTO EMP VALUES(6,'JEFF',5);

    COMMIT;

    SELECT * FROM EMP, (SELECT EMP_ID FROM EMP WHERE EMP_ID IN (1.5)) TEMP

    START BY EMP. EMP_ID = TEMP. EMP_ID

    CONNECT BY PRIOR EMP. EMP_ID = EMP. MANAGER_ID;

    Basically, I first spend a few emp_ids a subquery and then want to see all records in the table emp which are direct or indirect of those emp_ids children.

    But I get a lot of duplicate records. Can someone explain what is the reason behind this? I can use SEPARATE and spend, but there could be a problem with my request in the first place.

    Help, please!

    Thank you

    RN

    Thanks for posting the CREATE TABLE and INSERT statements; It is very useful.

    When you do CONNECT BY and joins in the same query (sub-), joins are made first, and then CONNECT BY is performed on all results of the joints.  In this example, you make a cross of PMCs and this join called temp.  Let's see what the result set looks like:

    SELECT *.

    WCP

    ,       (

    SELECT emp_ID

    WCP

    WHERE emp_id IN (1.5)

    ) temp

    ;

    Output:

    EMP_ID, EMP_NAME MANAGER_ID EMP_ID

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

    1 SCOTT 1

    2 1 1 JOHN

    3 ROB                 2          1

    4 1 2 MIKE

    5 BOB                            1

    JEFF 6 5 1

    1 SCOTT 5

    2 1 5 JOHN

    3 ROB                 2          5

    4 2 5 MIKE

    5 BOB                            5

    6 5 5 JEFF

    Now, you do a CONNECT BY query on the result set.  As you can see, there are 2 lines with emp_id = 2 in the set of results above, which explains why there are 2 lines in your query results with emp_id = 2.  Similarly, the output defined above, there are 2 lines with emp_id = 3, and they all have two manager_id = 2, each of them is considered to be a child of each of each of the 2 rows with emp_id = 2, and therefore, you have 2 * 2 = 4 lines with emp_id = 3 in the output CONNECT BY.

    What is a cross here join?  Why must you temp?  Why not just a CONNECT BY questioning one emp, like this:

    SELECT *.

    WCP

    START WITH emp_id IN (1, 5)

    CONNECT BY PRIOR Emp_id = manager_id

    ;

    ?

  • simple way to merge two rows in a

    11g 11.2.03
    with test_temp as 
     (select 'x' key,to_char(1) col1,null col2 from dual
      UNION
      select 'x' key,null col1,'a' col2 from dual
      UNION
      select 'y' key,'a' col1,'b' col2 from dual
      UNION
      select 'z' key,'a' col1,null col2 from dual
      UNION
      select 'z' key,null col1,to_char(2) col2 from dual)
    select * from test_temp
    gives
    KEY    COL1      COL2 
    ----- -------  -------  
    x        1
    x                  a
    y        a         b
    z        a       
    z                  2
    smart way to get:
    KEY    COL1      COL2 
    ----- -------  -------  
    x        1        a
    y        a        b
    z        a        2
    Essentially, I want to merge two lines based on a common key and remove all columns with NULL values, and merge them into a single line. The col1 and col2 can have any data types (number, char, date, etc.) ideas?

    Published by: user13007502 on July 13, 2012 01:11

    Published by: user13007502 on July 13, 2012 01:46

    Published by: user13007502 on July 13, 2012 02:05

    Published by: user13007502 on July 13, 2012 02:09

    user13007502 wrote:
    Sorry guys. My example was not the best. The numbers are just one example. I expanded the sample to display more realistic data.

    I just want to know if there is a smart way to merge two or more lines according to a key. Line is merged only when the merged line will result in a single line.

    So, as I said...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with test_temp as
      2   (select 'x' key,to_char(1) col1,null col2 from dual
      3    UNION
      4    select 'x' key,null col1,'a' col2 from dual
      5    UNION
      6    select 'y' key,'a' col1,'b' col2 from dual
      7    UNION
      8    select 'z' key,'a' col1,null col2 from dual
      9    UNION
     10    select 'z' key,null col1,to_char(2) col2 from dual)
     11  select key
     12        ,max(col1) as col1
     13        ,max(col2) as col2
     14  from test_temp
     15* group by key
    SQL> /
    
    K C C
    - - -
    z a 2
    x 1 a
    y a b
    

    What is the problem you are having?

    I feel that you don't even try the solutions proposed. Or well you're not giving us a pretty good example of what is the question.

  • Does anyone know how to merge two workseets number for printing?

    How can I combine two spreadsheets in numbers for printing?

    Hi jj,

    I assume that you mean that you have a single document, which contains two worksheets, and that each sheet contains one table (only?).

    What do you mean by "merge two (booklets)?

    You mean you wan to place Tables of two leaves on a single sheet (this sheet would contain then both tables).

    Or do you mean you want to place all data on the two tables into a single table on one sheet?

    Or do you mean something different to both of these descriptions?

    Kind regards

    Barry

  • How to merge two slideshows macOSX

    I'm trying to merge two slideshow on my mac Pro or Imac. If possible, I would like to keep the original music in both. But it is not critical.

    Thank you

    Slide show projects cannot be merged.

    If you visit both attractions like a video, you can add the two points of view in iMovie and display a merged video.

    Otherwise, duplicate a slide show and add photos of the second presentation to the other.

    What version of iPhoto do you use?

  • Why can I get two different results from the same coefficients?

    I get two different results of the evaluation of the polynomial function.

    For the first, I get the coefficients of a polynomial function to adapt.  I feed the coefficients of the function made the function Eval Poly and get the correct 12.8582 result when I evaluate 49940.

    For the second, I create constant array of values that have been returned by the polynomial Fit function (I typed in).  However, I get an incorrect result of - 120.7913 when I feed the constant table the function Eval Poly when I evauate 49940.

    How this can happen when I use the same values in table?

    A picture of what I explained is attached.

    Hi Altran,

    are you sure about using the 'same '?

    You compare them? Do you have (at least) set them to 17 digits display properties?

    Please attach a VI instead of an image...

  • need to merge two Skype accounts

    Hi, I need to merge two Skype accounts. How could I get this?

    Hello Heather

  • merging two partitions xp services Pack 3

    in microsoft site I am serching thi one give to it

    Merge a Partition in Windows

    • 1

      Click on the button of the menu 'start '.

    • 2

      Click on "Control Panel."

    • 3

      Click on "Administrative Tools".

    • 4

      Double-click 'Computer management'. If you are prompted to enter the administrator password, type it and press 'Enter' on your keyboard.

    • 5

      Choose "Disk management" option under the 'Storage' to display the list of all partitions on your disk or hard drives.

    • 6

      Right click on the partition that you want to merge with your primary hard drive.

    • 7

      Click on 'Delete Volume... "in the choice of menu.

    • 8

      Click the drive you want to partition space to merge with.

    • 9

      Click "Extend Volume... "Your computer automatically assigns all extra space to this player

      in the light of the foregoing, all are made, but I use xp ser pack 3 in there there is no opection of Volume to expand. How to merge two partitions in xp pack 3 ser

    Hello

    I don't know any way in XP except by specialist partition management software. I use Acronis Disk Director, but it costs! There may be some freebies autour but none I have meet in so I wouldn't comment on their reliability and efficiency, or even their ability to do what you want.

    If you're lucky, someone else can come back to this thread and give details of a free alternative.

    Tricky

  • Merge two pictures together

    What do I need have fun with my pictures, that is to say that merged two pictures together

    An image editing program. Iranview is a free good. Google for the link.

  • Merge two files administrator

    How a person merges two to an account administrator accounts. as merging all its account information 'A' and 'B' consideration, to make my computer only one account / account icon?

    You can't do that. You can create a new third user account, connect to it and then use Windows Explorer (my computer) to navigate around and copy data from the old accounts user (C:\Documents and Settings\old-user-acct) to your new user account. Then go to control panel > user accounts and remove unwanted accounts. Note that if you have XP Pro or Media Center, you'll see the built-in Administrator account (it is hidden by design, except in Mode without failure under XP Home). If this is your case, you cannot delete the built-in administrator or you would ever want. XP is a multi-user operating system, no matter if only one person is using it. In all operating systems multi-user - NT, Win2k, XP, Vista, Unix, Linux, Mac OSX - there is a built-in account that is 'God' on the system. In Windows terminology, is "Administrator". It is a required account and is not normally used in the daily work. In XP, you want to have a minimum of two user accounts on the system - your own user account for day-to-day work and the built-in administrator.

    If this has not answered your question, please clarify your situation. MS - MVP - Elephant Boy computers - don't panic!

  • NEED TO MERGE TWO ADMINISTRATIVE ACCOUNTS AND ALL THE FILES IN XP - NO WINDOWS 7! CANNOT FIND TRANSFER IFTO ANYWHERE.

    I desperately need to merge two administrative accounts on my laptop - using XP and NOT windows 7 (so there is no transfer Assistant). I need to transfer all of the OLD admin. account in the NEW Admin account.

    For the full backup used Carbonite - due erase hard drive and reinstall XP - carbonite cust. veeeeery slooooow service and I had to use the laptop for the preparatory work.  When the backup has been restored, he implemented the administrative account of origin, besides I have created a new.  Now, most of the files are under the old administrative account, and I need to move the OLD files in the NEW Admin account.

    Would sincerely appreciate your very specific instructions? ... step by step, if possible? Not quite a prolific technician, but no slouch, not more.

    Thank you very much!

    You can't really merge two accounts. You can copy data from one account to the other. Folder options > view tab > check "Show hidden files". Then go to:

    c:\Documents and Settings\name of the old account and copy the files to My Documents, desktop, Favorites in folders in your new user account. When you have all your stuff, you can delete the old user account from the control panel > user accounts. MS - MVP - Elephant Boy computers - don't panic!

  • Merge two favorite files - one of the former without losing new entries

    I'm trying to move the Favorites from one computer to another, without losing the favorites that have been added to the second computer, which can ONLY be the first. Once I have export favorites from the first computer on a port USB, import replace simply all the Favorites on the second computer folder or it will ask me if I want to record a new one to the old double the second favorite of the computer file (like when you save jpg files).

    Or is there another way to "merge" two folders, as visually opening upward both files and selecting what to switch to the hand...

    Thanx

    PS - am moving to Vista on a Windows 7 computer. as well as the synchronization of the two win 7 after that.

    Hi Maril,

    Thanks for posting your question in the Microsoft Community Forums.

    Based on the information, you find out when you try to move the Favorites from one computer to another, if the existing Favorites in the second computer will be deleted.

    Usually, when you import bookmarks to another computer, it will not replace the already existing bookmarks on the second computer.

    However, to be on the safer side, you can take a backup of the bookmarks on the second computer to another folder or another location.  Try favorites of the importation of the first computer to the second computer, check if you are able to access to existing favorites as well as any.

    If this is not the case, try adding the Favorites of the backup location to imported Favorites and check if it helps.

    You can also copy favorites from the second computer to the first computer and save it in a new folder. Try to create another folder containing the computer the two first and second Favorites and then import the Favorites from this folder to the second computer.

    For more information, see the article:

    Add, view, and organize Favorites

    Hope the helps of information.

    Let us know if you need help with Windows related issues. We will be happy to help you.

Maybe you are looking for

  • Apple TV 4th generation "audit failed there is a connection to the Apple ID server error."

    Can Hello someone please help me? I have a 4th generation Apple TV and I can't seem to accept my apple ID and password. That's what I've done so far: Chosen English (United Kingdom) Chosen UK Tried to associate a device with the establishment (iPhone

  • Windows 8.1 and YouTube error update

    I have upgraded to Win 8.1, Firefox v26, Shockwave, Flash and the most recent Java JRE. An error message and try again later will bring YouTube videos. The interesting feature is that IE v11 will show videos without any error. The upgrade to win 8.1

  • Can I use my 27 "IMac as a monitor for my Windows laptop

    Hello I want to use my iMac 27 "(fin 2012) as an external monitor for my Windows laptop." On my laptop, I have a miniDisplay port and on my iMac, I have a Thunderbolt connection. Is it posible to connect between them, or is it only possible to connec

  • hardware acceleration settings

    Under display settings / advanced settings/troubleshooting, where I would normally have the option to enable or disable hardware acceleration, the "Edit settings" button is disabled. Below, it is a message that says: "your current display driver does

  • New desktop PC

    Hello Soon I will buy a new hp desktop computer. In fact, I have an old hp desktop computer bought in 2005. Pentium 4 with 512 MB of ram and 200 GB 7 200 RPM. I want more speed for programs. I don't want a pc game. I want a new office for general use