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')
Similar Messages
-
How to combine several regex queries into a script?
Hi there,
is it possible to combine several regex queries into a javascipt? I export the text from a database with custom tags and the regex queries perform text AND character style replacements.
example
Let's say my exported text is the following
"I have a <tag_bold>very big text</tag_bold> that includes a lot of different character styles, such as <tag_bold>bold</tag_bold>, <tag_italic>italic</tag_italic>, <tag_bold>bold with some <tag_bold_underline>underlined words</tag_bold_underline></tag_bold>,
or ever words with different <tag_size-2>text size</tag_size-2>"
The result I want is
"I have a very big text that includes a lot of different character styles, such as bold, italic,
bold with some underlined words, or ever words with different text size"
Notice that all the tags open and close in the same paragraph and that there are nested tag pairs in some cases. So i execute my queries (more than 20) from the outer pair to the inner, that is:
<tag_bold>...</tag_bold>
<tag_italic>...</tag_italic>
<tag_size-2>...</tag_size-2>
<tag_bold_underline>...</tag_bold_underline>
Thanks in advance for your help
dpsHi Shonky,
thank you for your answer. It seems that it is very close to the solution.
1) I see now that my question was not clear enough.
In the text that is included between the tags, I want to apply a Character Style I have define in the character style palette of InDesign CS3.
That style can contain a lot of options, such as font family, size, style or color changes and is different for each tag.
2) I tested the function with my tags:
function my_replace (tag_bold)
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = '<' + 'tag_bold' + '>' + '(.+?)</' + 'tag_bold' + '>'; // here is the name i use in the regex tag
app.changeGrepPreferences.changeTo = '$1';
app.changeGrepPreferences.fontStyle = 'tag_bold'; //here is the name of the Character Style I have define in InDesign
app.activeDocument.changeGrep();
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences = NothingEnum.nothing;
result: nothing happens
3) Using in the script only the body of the function and running it, it highlights the right words with that pink color and shows that the Style of the text is "tag_bold", which is not available in the font family I use (Minion Pro).
I think that the function needs a modification in the line "app.changeGrepPreferences.fontStyle = 'tag_bold';", especially the "fontStyle" attribute, but I don't know what it is. I'm not a javascript expert and maybe I don't know the right way to use this function with InDesign. I read some books about InDesign Scripting and Regular expressions, but I didn't found all the answers I need as the one above or how I can run all the queries in one script (this is necessery because of the number and the order of scripts, to avoid mistakes).
Thanks
dps -
How to combine two user prompts into 1 single prompt from two Webi Queries
Hi All,
I developed a single webi report from two different queries on top of 2 BW OLAP universe .
Here I have one user input prompt for each query so I want to combine them into one single user input promt which should pass the user input value to both the Webi queries feeding data to the single webi report.
I found that the webi doc has auto checked merge dimensions enabled but it is not providing combined resluts from both the queries .
Any inputs are greatlt appreciated.
ThanksStratos
Firstly ,I appreciate your responses for my two questions.
Both the prompts I am using are from the masterdata and they are similar.data types.I think the transactional data is not available in BW for one of the prompt ,hence I am not getting consistent data.
Anyway will do further investigation in finding similarities and let you know.
Thanks a lot -
How to combine 20 identical shots into a single composite image
I want to shoot a moving water scene with a tripod mounted Canon DLSR and take +/- 20 images from the exact location and then combine them into a single composite shot in photoshop CS6. How do I go about this?
It sounds like you want to do image stacking. See Photoshop Help | Image Stacks (Photoshop Extended).
-
How to combine Submit and Commit into a single operation?
JDev 11.1.1.6
Is there a simple way to combine Submit and Commit or Create and Commit or Delete and Commit into a single operation without creating a custom Operation class?
Thanks,
PeeVeeHave a button and in the action listener event..you should drag and drop both create & commit onto your page so that it will have the required bindings in the pagedef.
OperationBinding createOperationBinding = ADFUtils.getOperationBindingForMethod("Create");
createOperationBinding.execute();
OperationBinding commitOperationBinding = ADFUtils.getOperationBindingForMethod("Commit");
commitOperationBinding.execute(); -
How to combine 2 spool id into a single PDF file
Hi,
I need to combine 2 or more spool id into a single PDF file.
i.e the downloaded PDF file should contain the data of all the specified spoll ids
Thank U
NarendraHi,
Use FM "RSPO_RETURN_ABAP_SPOOLJOB" to get the spool into internal table.
Append the internal table with data of another spool & then pass the internal table to the FM mentioned in above reply.
Best regards,
Prashant -
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
mayooran99I 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 -
How to combine these two inserts into a single insert ststement.
INSERT ZFMKSTEL FROM FS_TEMP_ZFMKSTEL.
fs_temp_zfmkstel-nrart = 'H'.
fs_temp_zfmkstel-proz1 = '100'.
insert into zfmkstel values fs_temp_zfmkstel.Hi,
U can use any one
First fill the values in wa
fs_temp_zfmkstel-telnum = fs_temp_zfm_handy-telnum.
fs_temp_zfmkstel-nrart = 'H'.
fs_temp_zfmkstel-proz1 = '100'.
insert into zfmkstel values fs_temp_zfmkstel.
Reward if this helps. -
How to combine several .MOV's into a single .MOV video?
Hi all,
I want to make a video xmas card for one of my friends. I would like to film several little tid-bits of myself in different places saying random stupidities but would like her to receive it in only one video instead of several.
I use a basic digital camera that has video. When I transfer the videos to my mac, they come out in .MOV format.
HOw do I stitch all of these together?
I hope I dont need to buy something!
Thanks a millionHave you tried using iMovie? It is part of the iLife suite which comes preinstalled on all Macs.
-
How to combine 4 angle shots into a single video clip
First of all, I am very much a novice in video editing and have yet to try Adobe Premiere.
I am working on a video project which will film a single subject from 4 different angles: front, back, left and right.
I would like to create a video clip which shows all 4 angle shots playing at the same time. Basically the video has 4 quadrants with each quadrant playing one of the angles.
Is this possible to do in Adobe Premiere? Any references or instructions?
Thanks.
DPI think that this link will reveal all.
http://tv.adobe.com/videos/multicam/ -
Possible to combine two xml documents into a single query?
In ASP, PHP, etc. if I wanted to combine two tables and
filter by one =
item, I would create a recordset combining the two on one
common element =
and have one recordset. Is that possible with xml documents
and Spry =
datasets?
I have xml information sent to me 4 times a day from a
weather service. =
This happens automatically, but the two xml documents
(current.xml and =
forecast.xml) are set in stone by the service. However, if in
my Spry =
dataset, I could combine them so I could list the 15 cities
in a master =
region and have tabs for the current conditions and forecast
which would =
each access a separate xml document but needs to do that from
the city =
link on the left, that would work great.
Can I do this as I would be able to if I had a database with
different =
tables?
Thanks!
NancyHi Kin:
They are really static xml files that are placed in a folder
directly by =
the weather service. The files in question are current.xml
and =
forecast.xml.
And there is not one per city .. but just one of each. the
location =
node in current.xml and the citycode node in forecast.xml
contain the =
same information.
If I were doing this in a recordset with a database, I would
write =
something like SELECT whatever from current, forecast WHERE =
current.location =3D forecast.citycode AND current.location
=3D variable =
(which would be what is clicked on).
This sets up a master/detail arrangement for the first one
that works =
fine. Click on the city code (which I have to write something
to say If =
location =3D FAT, document.write "Fresno" and so on) and the
rest of the =
current information displays fine on the right side of the
page. Now I =
have to marry that to the forecast.xml file so that when
citycode =3D =
FAT, the five day information for Fresno shows up .. and so
on. I was =
planning to use Spry tabs or whatever to show the data.
<!--
var dsCurrent =3D new Spry.Data.XMLDataSet("current.xml", =
"weather/current");
//-->
</script>
</head>
<body>=20
<div class=3D"MasterDetail">
<div spry:region=3D"dsCurrent"
class=3D"MasterContainer">
<div class=3D"MasterColumn" spry:repeat=3D"dsCurrent" =
spry:setrow=3D"dsCurrent" spry:hover=3D"MasterColumnHover" =
spry:select=3D"MasterColumnSelected">{location}</div>
</div>
<div spry:detailregion=3D"dsCurrent"
class=3D"DetailContainer">
<div class=3D"DetailColumn">{phrase}</div>
<div class=3D"DetailColumn">{temp}</div>
<div class=3D"DetailColumn">{temp/@units}</div>
<div class=3D"DetailColumn">{aptemp}</div>
<div class=3D"DetailColumn">{aptemp/@unit}</div>
<div class=3D"DetailColumn">{wndchl}</div>
<div class=3D"DetailColumn">{wndchl/@unit}</div>
<div class=3D"DetailColumn">{rhumid}</div>
<div class=3D"DetailColumn">{rhumid/@unit}</div>
<div class=3D"DetailColumn">{wind_dir}</div>
<div class=3D"DetailColumn">{windspeed}</div>
<div
class=3D"DetailColumn">{windspeed/@unit}</div>
<div class=3D"DetailColumn">{pres}</div>
<div class=3D"DetailColumn">{pres/@unit}</div>
<div class=3D"DetailColumn">{vis}</div>
<div class=3D"DetailColumn">{vis/@unit}</div>
<div class=3D"DetailColumn">{icon}</div>
</div>
Arnout gave me some suggestions .. but so far, I haven't
gotten either =
of them to work. Also I am trying to get some ideas from spry
Samples =
from the Spry home page/samples area, but again .. not yet.
Thanks,
Nancy
"kinblas" <[email protected]> wrote in
message =
news:[email protected]...
>I don't think you need to combine them just so they can
render in a =
tabbed=20
> widget. We're still missing a couple of key pieces of
information. =
What does=20
> the data that is used in the master region look like?
Are what you =
refer to as=20
> current.xml and forecast.xml really static files? Or are
they =
dynamically=20
> generated by a server side script (php/cf/etc)? There is
one current =
and=20
> forecast xml per city right?
>=20
> I ask these questions because you may be able to simply
set up a =
master detail=20
> relationship between 3 data sets and just use those
within a region(s) =
that=20
> build up the tab widget. Assuming you were getting the
list of cities =
from a=20
> 3rd source, you could set up something like this:
>=20
>=20
> var dsCities =3D new Spry.Data.XMLDataSet("cities.xml",
=
"/cities/city");
> var dsCurrent =3D new=20
>
Spry.Data.XMLDataSet("current.php?location=3D{dsCities::name}",=20
> "/weather/current");
> var dsForecast =3D new=20
>
Spry.Data.XMLDataSet("forecast.php?citycode=3D{dsCities::name}",=20
> "/weather/forecast/day");
>=20
>=20
> ...
>=20
>=20
> <div id=3D"TabbedPanels1" class=3D"TabbedPanels">
> <ul class=3D"TabbedPanelsTabGroup">
>
Current</li>
>
Forecast</li>
>
> <div class=3D"TabbedPanelsContentGroup">
> <div class=3D"TabbedPanelsContent"
spry:region=3D"dsCurrent">
> {temp}{temp/@unit}
> </div>
> <div class=3D"TabbedPanelsContent"
spry:region=3D"dsForecast">
>
> <li spry:repeat=3D"dsForecast">{name}<br
/>High: =
{high}{high/@unit}<br=20
> />Low: {low}{low/@unit}</li>
>
> </div>
> </div>
> </div>
>=20
>=20
>=20
> --=3D=3D Kin =3D=3D--
> -
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/fv3zxa38nwith 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. -
How to Combine Multiple Physical Queries
Hi All,
I have a big reports with over 70-80 columns in Answer. This is not a Pivot report. Now it is generating 3 physical queries .
I need to merge this 3 queries into a single query. But it seems very hard to implement.
Couple of points:
1. Report is generating 3 physical queries. All queries are GROUP BY queries and each of them giving different count separately
2. If we find a way to combine. The result would be different from Answers Report Result (This is my assumption)
3. How Answer is combining the results from 3 queries and showing us the result?
Any input or thought is high appreciated.
I'm totally stuck in there. Tried different ways. But is there any solution for this that I'm not able to think?
Pls Help
Thanks in Advance
Regards
SudiptaHi Kranthi,
Thanks for you reply.
I need to combine multiple report queries into one and give it to ETL guys. I don't have to do anything in Answers. This is my requirement.
I'm good in SQL. So I tried to combine like the following. Taking a small scenario.
In this case, Anlytics is generating following 2 queries:
Query 1:
select sum(x), [Fact column]
sum(y), [Fact column]
column1, [Dim column]
column2, [Dim column]
column3, [Dim column]
from table1,table2,table3
where [All joins]
group by column1,column2,column3
Query 2:
select sum(z), [Fact column]
column1, [Dim column]
column2, [Dim column]
column3, [Dim column]
from table1,table2,table3
where [All joins]
group by column1,column2,column3
I'm trying to combine it:
Query 1:
select sum(x), [Fact column]
sum(y), [Fact column]
sum(z), [Fact column]
column1, [Dim column]
column2, [Dim column]
column3, [Dim column]
from
(select sum(x), [Fact column]
sum(y), [Fact column]
column1, [Dim column]
column2, [Dim column]
column3, [Dim column]
from table1,table2,table3
where [All joins]
group by column1,column2,column3
) q1,
select sum(z), [Fact column]
column1, [Dim column]
column2, [Dim column]
column3, [Dim column]
from table1,table2,table3
where [All joins]
group by column1,column2,column3
) q2
where
q1.column1=q2.column1 and
q1.column2=q2.column2 and
q1.column3=q2.column3
But i think it is not the correct way may be, as i'm getting a bit different count. So the where conditions are not matching for the 2 queries above.
Any thought on this?
Thanks
Sudipta -
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 UtahNot possible with Reader. You need Acrobat or a subscription to something like PDF Pack to do it.
-
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.
Maybe you are looking for
-
VISA Write differs between TS Development System and LV Run-Time Engine
Hi all I made an application on LabVIEW to test BERs (Bit Error Rates), and I used VISA Write between two COM ports to exchange data. Everything works fine using just LabVIEW. Afterwards, I used TestStand to call my application (VI). The LabVIEW adap
-
Checked checkboxes in Numbers for iPad
Hi, Before submitting feedback to Apple about the following glitch, I'm posting it here to find out whether any Numbers for iOS jockeys have experienced the glitch also. In Numbers 09 (2.0.3) under Snow Leopard.8, I imported a spreadsheet created in
-
HI All, Is there possible in SAP Restriction of client. Ex:-Suppose in EID100 client only five user can can login.If Sixth user tries it will show a error message that U R not Authorize person to login. Any one help on this regards. Thanks. Sin
-
Re: customer service dept/faults team
I have dealt with the India-based faults service at intervals over a number of years, mainly for b.b. problems. It does not get any better! This morning I found my phone had gone down overnight. Have spent approx. 4 hrs today dealing with them. Th
-
Why duplicate emails in MacMail?
Both on my iMac and my wife's MacBook we are both suddenly getting two identical copies of nearly every email. This happened once before and then went away. How do we stop it? My web site was just hacked but I didn't think it affected the email.