I have these below queries. How do I join these 3 queries into a single query?

1st query:
SELECT TOP(1) @tmpOnlineCat = ac.AlertCatID
FROM alert.AlertCategory ac
WHERE ac.FkAlertID = 2
AND ac.FkAlertTypeID = 3
2nd query
SELECT TOP(1) @tmpOfflineCat = ac.AlertCatID
FROM alert.AlertCategory ac
WHERE ac.FkAlertID = 3
AND ac.FkAlertTypeID = 3
3rd query
INSERT INTO item.ItemOnlineOfflineAlertCategory
VALUES
@tmpPkItemID,
@tmpOfflineCat,
@tmpOnlineCat
mayooran99

I think this is all what you need!
INSERT INTO item.ItemOnlineOfflineAlertCategory
SELECT @tmpPkItemID,
MAX(CASE WHEN FkAlertID = 2 THEN AlertCatID END) AS tmpOnlineCat,
MAX(CASE WHEN FkAlertID = 3 THEN AlertCatID END) AS tmpOfflineCat
FROM alert.AlertCategory
WHERE FkAlertTypeID = 3
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • QUESTION:  In Elements 12, how do I join together separate slideshows into a single integrated alideshow?

    QUESTION:  In Elements 12, how do I join together separate slideshows into a single integrated alideshow?

    I hate to say this, but there is no way to put 1280X720 footage on a 1920X1080 sequence and upscale it to match the frame size without losing some quality. Basically, you are asking Premiere Pro to provide new pixels that were not in the original video. That is seldom a really good idea. You might want to try investing in program designed to upscale video. I have never used this, but there is a free trial, so give it a shot: http://www.infognition.com/VideoEnhancer/
    Of course, it all depends on the content. Try it with Premiere Pro. Only you can judge. However, you might need to consider putting all of your 1920X1080 on a 1280X720 sequence instead, and just produce your video at that size.
    Or, once again, this depends on the content, put some sort of frame around the smaller footage, either a blurred out version of the upscaled footage - lots of TV stations do this with 4:3 footage on a HD program, or purposefully make it even a little smaller, or crop it, and use parts of the same video in Picture-In-Picture. You have seen this before. A person talking on the phone in a larger frame to the left, and on the right a closeup of the mouth, or maybe a clip of the person they are talking to. Or use some B-Roll in the PiP.
    Get imaginative, because you already know that you messed up, so perhaps make it look like you did it on purpose.

  • How to combine below 4 queries into a single query?

    SELECT COUNT(*) AS NORMAL_PASS
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =1 AND TESTFLAG =1)
    SELECT COUNT(*) AS NORMAL_FAIL
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =1 AND TESTFLAG =2)
    SELECT COUNT(*) AS REPEAT_PASS
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =2 AND TESTFLAG =1)
    SELECT COUNT(*) AS REPEAT_FAIL
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =2 AND TESTFLAG =2)

    Are you looking for the below:
    SELECT COUNT(*) as Cnt, 'NORMAL_PASS' as [Type]
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =1 AND TESTFLAG =1)
    Union All
    SELECT COUNT(*) , 'NORMAL_FAIL'
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =1 AND TESTFLAG =2)
    Union All
    SELECT COUNT(*) , 'REPEAT_PASS'
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =2 AND TESTFLAG =1)
    Union All
    SELECT COUNT(*) , 'REPEAT_FAIL'
    FROM (
    SELECT MAINSERNO
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556' AND TESTMODE =2 AND TESTFLAG =2)
    Or
    SELECT MAINSERNO,Count(Case when TESTMODE =1 AND TESTFLAG =1 Then 1 Else NULL End) as 'Normal_Pass',
    Count(Case when TESTMODE =1 AND TESTFLAG =2 Then 1 Else NULL End) as 'Normal_Fail',
    Count(Case when TESTMODE =2 AND TESTFLAG =1 Then 1 Else NULL End) as 'Repeat_Pass',
    Count(Case when TESTMODE =2 AND TESTFLAG =2 Then 1 Else NULL End) as 'Repeat_Pass'
    FROM SGSTUDENT.PPL_PRODUCT_TESTID2
    WHERE (MONO = '5954556')

  • Combine 2 Queries (from SAME table) into a SINGLE query

    I have this two queries (from SAME table), and want to combine into one SINGLE query, how?
    How can we use CASE WHEN THEN for such situation? 
    Query1:
    SELECT t_inner.*,
    Floor(t_inner.ProductiveTime/ 3600) || 'hr:' || LPAD(Floor(Mod(t_inner.ProductiveTime,3600) / 60),2,0) || 'min:' AS Productive_Time,
    Floor(t_inner.OperatorDownTime/ 3600) || 'hr:' || LPAD(Floor(Mod(t_inner.OperatorDownTime,3600) / 60),2,0) || 'min:' AS OperatorDown_Time
    FROM
    (SELECT SYSTEMTYPE,
    sum(TIME_TEST + TIME_STEP) AS ProductiveTime,
    sum(TIME_IDLE) AS OperatorDownTime
    FROM PFODS.PPL_TESTSYSTEMS_UTILISATION
    WHERE (SYSTEMTYPE = '0005-072')
    AND (TS_START >= to_date('13/01/2014', 'DD/MM/YYYY'))
    AND TS_End <= to_date('17/01/2014', 'DD/MM/YYYY') + 1 + (1/1440) +(59/86400)
    AND MONO != '9999999999'
    GROUP BY SYSTEMTYPE ) t_inner
    Query 2:
    SELECT t_inner.*,
    Floor(t_inner.MachineDownTime/ 3600) || 'hr ' || LPAD(Floor(Mod(t_inner.MachineDownTime,3600) / 60),2,0) || 'min' AS MachineDown_Time
    FROM
    (SELECT SYSTEMTYPE,
    sum(TIME_IDLE) AS MachineDownTime
    FROM PFODS.PPL_TESTSYSTEMS_UTILISATION
    WHERE (SYSTEMTYPE = '0005-072')
    AND (TS_START >= to_date('13/01/2014', 'DD/MM/YYYY'))
    AND TS_End <= to_date('17/01/2014', 'DD/MM/YYYY') + 1 + (1/1440) +(59/86400)
    AND MONO = '9999999999'
    GROUP BY SYSTEMTYPE) t_inner
    see http://postimg.org/image/koq87iyyz/  and
    http://postimg.org/image/fv3zxa38n

    with the first query, 
    SELECT t_inner.*,
    Floor(t_inner.ProductiveTime/ 3600) || 'hr:' || LPAD(Floor(Mod(t_inner.ProductiveTime,3600) / 60),2,0) || 'min' AS Productive_Time
    FROM
    (SELECT SYSTEMTYPE,
    --sum(TIME_TEST) AS TIME_TEST,
    --sum(TIME_SYSTEM) AS TIME_SYSTEM,
    --sum(TIME_STEP) AS TIME_STEP,
    --sum(TIME_IDLE) AS TIME_IDLE,
    sum(TIME_TEST + TIME_STEP) AS ProductiveTime
    FROM PFODS.PPL_TESTSYSTEMS_UTILISATION
    WHERE (SYSTEMTYPE = '0005-072')
    AND (TS_START >= to_date('13/01/2014', 'DD/MM/YYYY'))
    AND TS_End <= to_date('17/01/2014', 'DD/MM/YYYY') + 1 + (1/1440) +(59/86400)
    AND MONO != '9999999999'
    GROUP BY SYSTEMTYPE) t_inner
    it gives output as from 
    http://postimg.org/image/koq87iyyz/
    with the second query,
    SELECT t_inner.*,
    Floor(t_inner.MachineDownTime/ 3600) || 'hr ' || LPAD(Floor(Mod(t_inner.MachineDownTime,3600) / 60),2,0) || 'min' AS MachineDown_Time
    FROM
    (SELECT SYSTEMTYPE,
    sum(TIME_IDLE) AS MachineDownTime
    FROM PFODS.PPL_TESTSYSTEMS_UTILISATION
    WHERE (SYSTEMTYPE = '0005-072')
    AND (TS_START >= to_date('13/01/2014', 'DD/MM/YYYY'))
    AND TS_End <= to_date('17/01/2014', 'DD/MM/YYYY') + 1 + (1/1440) +(59/86400)
    AND MONO = '9999999999'
    GROUP BY SYSTEMTYPE) t_inner
    it gives output as from 
    http://postimg.org/image/fv3zxa38n/
    I want to come those 2 queries into a single query, such that it gives both outputs as above. Let me know if you need any other information. thanks.

  • ITunes is indicating i have another iTunes library, how do I combine the 2 libraries into 1? Previous computer was a PC using iTunes.

    iTunes has indicated i have another iTunes library, how do i combine the 2 libraries into 1?
    My previous computer was a PC. I synced iTunes with my iPhone until the hard drive died, then I bought an iMac.
    Thanks for you help.

    I want to be able to transfer my apps from my original itunes account that I have on my personal iphone 3 and work ipad 3 to my work iphone 4S ,as well as purchase more more apps for the work iphone with the original itunes account.  Plus I need to sync all 3 of them with my work tower computer.  I really appreciate you're trying to help me out.

  • How do you combine 2 mono tracks into a single stereo track?

    Question here:
    How do I combine 2 mono tracks into a single stereo track in Logic?
    I recorded using my left and right out of my keyboard to a hard-disk recorder (Korg d888). The files are made as two separate wav files. Is there way to combine these in Logic so I can treat it as one stereo track?
    I have several files to do and am hoping Logic has something like a "combine tracks to stereo track" tool or something.

    Solo both tracks and bounce them with no effects and faders at 0 dB.

  • How do i combine multiple pdf file into a single pdf file?

    how do i combine multiple pdf files into a single pdf file?

    The thread was started in early March and it's Mid-April, I know this very well. The OP of this thread posted a very common and simple question or maybe he/she would have resolved this. For an Adobe Acrobat user it's not at all difficult to combine multiple PDF files into one. But to combine PDF files full version of Adobe Acrobat is mainly required, otherwise PDF files can't be combined. For example, I'm using Adobe Acrobat 9 Pro. These simple steps are mainly required to combine PDF files:
    Open Adobe Acrobat.
    Click on Combine and click on Merge files into a single PDF.
    A window will be appearing, click on Add Files and select the PDF files you want to combine.
    Arrange the selected files in any order with the help of Move Up and Move Down button.
    Now click on Combine File and the selected PDF files will be combined within a few seconds.
    A new PDF file will be created. Click on Save As and name this new PDF file. Then, click on Save.
    A new PDF file will be created and all the selected PDF files are combined in it. The steps shown above might be different in other versions of Adobe Acrobat. Other than this, some third-party PDF merge software are also available. Most of them are available with a demo version for free evaluation. I've heard much about SysInfoTools PDF Merge software on other forums and directories and it's demo version is freely available. One may check its demo version if Adobe Acrobat (full version) is not available.
    Regards

  • How do I merge 105 PDF's into a Single PFD?

    How do I merge 105 pdf's into a single PDF.
    I have already tried doing this in PREVIEW, selecting all, and then saving, and saving as. But it is for me, to no avail. When I re-open, all I get is the first page.
    please help.

    CRB wrote:
    How do I merge 105 pdf's into a single PDF.
    I have already tried doing this in PREVIEW, selecting all, and then saving, and saving as. But it is for me, to no avail. When I re-open, all I get is the first page.
    So, I'm not the only one unable to merge docs thru Preview.
    This is why I wrote my own script to do that.
    --[SCRIPT join_PDFs]
    Enregistrer le script en tant que Script : join_PDFs.scpt
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:
    aller au menu Scripts , puis choisir join_PDFs
    Vous pouvez également enregistrer le script en tant qu'application.
    Vous pourrez alors glisser déposer les icônes de PDFs à fusionner sur celle du script.
    J'ai trouvé le code principal dans une page Web.
    --=====
    L'aide du Finder explique:
    L'Utilitaire AppleScript permet d'activer le Menu des scripts :
    Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case "Afficher le menu des scripts dans la barre de menus".
    Sous 10.6.x,
    aller dans le panneau "Général" du dialogue Préférences de l'Éditeur Applescript
    puis cocher la case "Afficher le menu des scripts dans la barre des menus".
    --=====
    Save the script as a Script: join_PDFs.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:
    go to the Scripts Menu, choose Numbers, then choose "join_PDFs"
    You may also save the script as an application.
    Then you will be anle to drag an drop PDFs icons on the script one.
    I found the main code in a Web page.
    --=====
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2011/01/18
    --=====
    on run
    if parle_anglais() then
    set les_fichiers to choose file "Select the PDFs files to merge" of type {"com.adobe.pdf"} with multiple selections allowed without invisibles
    else
    set les_fichiers to choose file "Sélectionner les fichiers PDFs à fusionner" of type {"com.adobe.pdf"} with multiple selections allowed without invisibles
    end if
    my main(les_fichiers)
    end run
    --=====
    on open sel
    my main(sel)
    end open
    --=====
    on main(lesPDFs)
    local p2s, alias_existe, aPath, chemindu_nouveauPDF, les_UNIXs
    set lesPDFs to lesPDFs as list -- just for safe
    set p2s to "" & (path to startup disk)
    tell application "System Events" to set alias_existe to exists disk item (p2s & "joinPDF.py")
    If it doesn't exist, create a symbolic link to a python script
    delivered by Apple in an Automator process.
    if not alias_existe then
    set aPath to quoted form of "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py"
    do shell script "ln -s " & aPath & " joinPDF.py"
    end if
    set chemindu_nouveauPDF to "" & (path to documents folder) & (do shell script "date +_%Y%m%d-%H%M%S") & ".pdf"
    set les_UNIXs to {}
    repeat with i from 1 to count of lesPDFs
    copy quoted form of POSIX path of item i of lesPDFs to end of les_UNIXs
    end repeat
    set les_UNIXs to my recolle(les_UNIXs, space)
    do shell script "./joinPDF.py -o " & quoted form of POSIX path of chemindu_nouveauPDF & space & les_UNIXs
    tell application "Finder" to open file chemindu_nouveauPDF
    end main
    --=====
    on recolle(l, d)
    local oTIDs, t
    set oTIDs to AppleScript's text item delimiters
    set AppleScript's text item delimiters to d
    set t to l as text
    set AppleScript's text item delimiters to oTIDs
    return t
    end recolle
    --=====
    on parle_anglais()
    return (do shell script "defaults read 'Apple Global Domain' AppleLocale") does not start with "fr_"
    end parle_anglais
    --=====
    --[/SCRIPT]
    Yvan KOENIG (VALLAURIS, France) mardi 18 janvier 2011 12:24:51

  • How can I convert the volume directory into a single file installer?

    How can I convert the volume directory into a single file installer? I would like to hide all the miscillaneous files that I don't care for and be able to have the installer double click a single file and have it automatically install.

    On the second prompt screen when prompted 'What kind of self-extracting Zip file file do you want to make?'
    Are you choosing the second option (self-extracting Zip file for software installation)?
    I have a word file that I created to help me remember - is there anyway to email it to you?

  • How do I combine several pdf files into a single file (MAC OS)?

    How do I combine several pdf files into a single file ?
    MAC OS 10.6.8
    Adobe Reader 11.0.10
    Signed: Ken, in Utah

    Not possible with Reader. You need Acrobat or a subscription to something like PDF Pack to do it.

  • Can we show 2 queries in a single query ?

    Hi experts,
    We require an output of a bex query.
    But the output is coming in two different queries.
    Is it possible to show two queries in a single query ?
    Regards,
    Nishuv.

    Hi Praveen,
    We are using bex 3.x. I opened a workbook. in the view toolbar->Toolbars->Control Toolbox.
    I clicked on this. A tool box came in the right side of the sheet.
    The options which we got here are:
    Exit Design mode
    Properties
    View code
    Check box
    Text box
    Command button
    Option button
    List box
    Combo box
    Toogle button spin button
    Scrool bar
    Label
    Image
    More controls
    Tool bar options.
    Here i am not able to see the Analysis grid.
    Is there anything more to be done to get this ?
    Regards,
    Nishuv.

  • How many files that JAR can bundle into a single file?

    How many files that JAR can bundle into a single file?

    The are no limitations inherent in the ZIP file format (jar files are basically just zip files).
    The only limitations I can think of are;
    available disk space
    maximum file size (for some filesystems)

  • HT1518 I have a Universal Keyboard how to I insert the copywrite symbol into my photographs

    Have tried but to no avail, how can I insert the Copywrite symbol into my photographs to protect them before posting online please.

    Alberto Ravasio wrote:
    You meant option+C
    Nope. On an English keyboard you get © with option-g. Option-c gets you ç.

  • How do I join multiple mp3 files into one mp3 file?

    Hello,
    I have multiple mp3 files that I would like to join into one mp3 file and to use it as an audio book. This explains how to do it, but in iTunes 12, I do not see an option called "Part of a Compilation" option.
    Is there a way to do it in iTunes without installing a new app?
    Thank you.

    Eugene,
    Those instructions, if I read them correctly, are about how to collect several MP3s into a single audiobook.  They will not create a single continuous MP3.
    iTunes does not have the ability to combine multiple MP3s into a single MP3.  The best it can do is if you burn them to audio CD and then rip back with "Join Tracks" enabled.  The better way is to use an audio editor such as Audacity, or a special purpose combing tool such as MP3 Joiner.

  • How Can I Convert Multiple TextEdit Files Into A Single Giant File?

    For example. I have multiple chapters for my new book each saved as individual files, and I want to combine all the chapters into one single continual file that I can work with in either Text Edit or Word. How can I do this? It's hundreds of files... ∆
    Thanks!

    Hi Bruce, Tex-Edit Plus for OS X...
    http://www.tex-edit.com/
    It can Merge files then Sort them easily, even has a remove duplicate lines script available.
    If the version you get doesn't have the sort perchance, here's a link, put sort in the search scripts box, get the second one, Sort Selection...
    http://dougscripts.com/texedit/

Maybe you are looking for