Running total required but with different timing
Hi All:
I am using Oracle9i Enterprise Edition Release 9.2.0.6.0
I want to write a query to display the statistics report with running total.
I have written following query that return last 60 minutes activities.
SELECT se.tserv_id,
sum(decode(eu.category,'I',1,0)) Imp,
sum(decode(eu.category,'E',1,0)) Exp,
count(*) Total
FROM service_events se, equipment_uses eu
WHERE se.performed BETWEEN trunc(sysdate-60/1440,'mi')
AND trunc(sysdate,'mi')
AND se.tserv_id IN ('EXM','GROUNDED')
AND eu.gkey = se.equse_gkey
AND eu.category IN ('I','E')
GROUP BY se.tserv_id;
now I want to write a query that shows me the result of above query and running total as well
But the different between current activity and running total is as follows
Current Activity = Last 60 minutes activity
Running Total = Total activities from the 08:00 am till sysdate.
for example if this query executed on 11:00 am then the current activity values must be from 10:00 am to 11:00 am and the running total values must be from 08:00 am to 11:00 am
The reason for running total starts at 08:00 am is that the shift starts from 08:00 am to next day 07:59 am.
Can I write one single query for this?
Similarly running total values must be start from last day 08:00 am to current date and time when I executed this query from 00:00 to 08:00 (12 midnight to 8am)
if difficult then plz let me know that how can I find that if the time is from 00 hrs to 08 hrs then start time must be the last date 08:00 am to the current date and time.
Thanks
Hassan
Dear Frnak
Thanks for your reply and help
Its really did what I want
I mean to say that the result format is correct but the value of Total_day column is not correct.
Following is the sample data from 19-Jun-2008 08:00 AM to 20-JUN-2008 08:00 AM
TSERV_ID EQUSE_GKEY PERFORMED
===============================================
EXM 5188958 19-Jun-2008 8:00:32 AM
EXM 5185586 19-Jun-2008 9:03:34 AM
EXM 5181960 19-Jun-2008 9:03:35 AM
EXM 5173333 19-Jun-2008 9:03:35 AM
EXM 5188263 19-Jun-2008 9:08:49 AM
GROUNDED 5174055 19-Jun-2008 9:10:29 AM
GROUNDED 5152887 19-Jun-2008 9:10:29 AM
GROUNDED 5187512 19-Jun-2008 9:10:29 AM
GROUNDED 5196303 19-Jun-2008 9:27:41 AM
EXM 5196370 19-Jun-2008 9:29:50 AM
EXM 5172045 19-Jun-2008 10:01:23 AM
GROUNDED 5196269 19-Jun-2008 11:11:29 AM
GROUNDED 5200219 19-Jun-2008 11:24:39 AM
GROUNDED 5185246 19-Jun-2008 12:06:30 PM
GROUNDED 5190134 19-Jun-2008 12:09:27 PM
GROUNDED 5190475 19-Jun-2008 12:09:27 PM
GROUNDED 5156065 19-Jun-2008 12:26:49 PM
GROUNDED 5132287 19-Jun-2008 1:56:44 PM
EXM 5189203 19-Jun-2008 2:29:17 PM
EXM 5180158 19-Jun-2008 3:27:03 PM
EXM 5149310 19-Jun-2008 3:37:31 PM
EXM 5196303 19-Jun-2008 3:42:48 PM
EXM 5192768 19-Jun-2008 4:03:51 PM
EXM 5174055 19-Jun-2008 4:14:23 PM
EXM 5200231 19-Jun-2008 4:45:51 PM
EXM 5157151 19-Jun-2008 4:51:06 PM
EXM 5159930 19-Jun-2008 5:01:36 PM
EXM 5185237 19-Jun-2008 5:01:37 PM
EXM 5195434 19-Jun-2008 5:01:37 PM
EXM 5152887 19-Jun-2008 5:06:49 PM
EXM 5196269 19-Jun-2008 5:06:49 PM
EXM 5187512 19-Jun-2008 5:17:26 PM
EXM 5190134 19-Jun-2008 5:59:24 PM
GROUNDED 5101919 19-Jun-2008 6:44:36 PM
GROUNDED 5101918 19-Jun-2008 6:44:37 PM
GROUNDED 5101913 19-Jun-2008 6:44:37 PM
EXM 5185735 19-Jun-2008 6:46:38 PM
GROUNDED 5195475 19-Jun-2008 6:47:11 PM
GROUNDED 5195361 19-Jun-2008 6:47:12 PM
EXM 5132608 19-Jun-2008 7:02:23 PM
GROUNDED 5195334 19-Jun-2008 7:10:32 PM
GROUNDED 5190558 19-Jun-2008 7:10:32 PM
EXM 5183029 19-Jun-2008 7:33:53 PM
EXM 5183480 19-Jun-2008 7:39:12 PM
EXM 5189566 19-Jun-2008 8:00:11 PM
EXM 5181825 19-Jun-2008 8:15:57 PM
EXM 5183537 19-Jun-2008 8:15:57 PM
EXM 5180210 19-Jun-2008 9:08:27 PM
GROUNDED 5193136 19-Jun-2008 9:58:23 PM
EXM 5171510 19-Jun-2008 10:21:59 PM
EXM 5185615 19-Jun-2008 10:48:14 PM
EXM 5184737 19-Jun-2008 10:53:29 PM
EXM 5195475 19-Jun-2008 11:51:16 PM
EXM 5195476 20-Jun-2008 12:01:46 AM
EXM 5190558 20-Jun-2008 12:12:17 AM
EXM 5196473 20-Jun-2008 12:54:19 AM
EXM 5183204 20-Jun-2008 1:20:34 AM
GROUNDED 5192844 20-Jun-2008 1:28:24 AM
GROUNDED 5174238 20-Jun-2008 1:28:24 AM
GROUNDED 5193127 20-Jun-2008 1:28:24 AM
GROUNDED 5185794 20-Jun-2008 1:29:09 AM
GROUNDED 5192895 20-Jun-2008 3:04:23 AM
GROUNDED 5193039 20-Jun-2008 3:04:23 AM
GROUNDED 5195447 20-Jun-2008 3:04:23 AM
GROUNDED 5190228 20-Jun-2008 3:04:24 AM
GROUNDED 5179370 20-Jun-2008 3:04:24 AM
GROUNDED 5190289 20-Jun-2008 3:04:24 AM
GROUNDED 5174065 20-Jun-2008 3:04:24 AM
GROUNDED 5192862 20-Jun-2008 5:04:42 AM
GROUNDED 5199903 20-Jun-2008 5:04:42 AM
EXM 5178176 20-Jun-2008 6:30:29 AM
EXM 5185161 20-Jun-2008 6:46:14 AM
EXM 5180226 20-Jun-2008 6:46:14 AM
GROUNDED 5202026 20-Jun-2008 7:03:14 AM
EXM 5101912 20-Jun-2008 7:07:14 AM
GROUNDED 5176763 20-Jun-2008 7:25:27 AM
GROUNDED 5185494 20-Jun-2008 7:25:27 AM
EXM 5185295 20-Jun-2008 7:38:46 AM
EXM 5173837 20-Jun-2008 7:49:15 AM
GKEY CATEGORY
=================
5101912 I
5101913 I
5101918 I
5101919 I
5132287 I
5132608 I
5149310 I
5152887 I
5156065 I
5157151 I
5159930 I
5171510 I
5172045 I
5173333 I
5173837 I
5174055 I
5174065 I
5174238 I
5176763 I
5178176 I
5179370 I
5180158 I
5180210 I
5180226 I
5181825 I
5181960 I
5183029 I
5183204 I
5183480 I
5183537 I
5184737 I
5185161 I
5185237 I
5185246 I
5185295 I
5185494 I
5185586 I
5185615 I
5185735 I
5185794 I
5187512 I
5188263 I
5188958 I
5189203 I
5189566 I
5190134 I
5190228 I
5190289 I
5190475 I
5190558 I
5192768 I
5192844 I
5192862 I
5192895 I
5193039 I
5193127 I
5193136 I
5195334 I
5195361 I
5195434 I
5195447 I
5195475 I
5195476 I
5196269 I
5196303 I
5196370 I
5196473 I
5199903 I
5200219 E
5200231 E
5202026 EAnd I used the same query suggested by you.
WITH s AS(
SELECT se.tserv_id , eu.category ,
CASE
WHEN se.performed BETWEEN
to_date('&target_dt','DD-MON-RRRR HH24:MI') - (1/24)
AND to_date('&target_dt','DD-MON-RRRR HH24:MI')
THEN 1
ELSE 0
END AS in_hour ,
CASE
WHEN TRUNC (se.performed - (8/24)) = TRUNC (to_date('&target_dt','DD-MON-RRRR HH24:MI')
- (8/24))
THEN 1
ELSE 0
END AS in_day
FROM service_events se , equipment_uses eu
WHERE eu.gkey = se.equse_gkey
AND eu.category IN ('I', 'E')
AND se.tserv_id in ('EXM','GROUNDED')
SELECT tserv_id,
SUM (DECODE (category, 'I', in_hour)) AS imp_hour,
SUM (DECODE (category, 'E', in_hour)) AS exp_hour,
SUM (in_hour) AS total_hour,
SUM (in_day) AS total_day
FROM s
GROUP BY tserv_idNow you have the sample data for almost 24 hours
Let me clear it again
When I executed this query at 20-JUN-2008 09:00 AM it gives me following result (that is accurate)
TSERV_ID IMP_HOUR EXP_HOUR TOTAL_HOUR TOTAL_DAY
EXM 2 0 2 3
GROUNDED 1 0 1 8When I executed this query between 20-JUN-2008 00:00 to 20-JUN-2008 08:00
then system must show the Total_Day value from 19-JUN-2008 08:00 to current date and time. e.g
I executed this query at 20-JUN-2008 06:00 AM it gives me following result:
TSERV_ID IMP_HOUR EXP_HOUR TOTAL_HOUR TOTAL_DAY
EXM 0 0 0 44
GROUNDED 2 0 2 35Now here you can see that the value of Total_Day is not as accurate as I required:
EXM = 44 and GROUNDED = 35
these values are between 19-JUN-2008 00:00 to 20-JUN-2008 06:00 (that is wrong in my case)
The values of total_day should be as follows as 8 hours from 00:00 to 07:59 AM fall in the shift of 18-JUN-2008 not in 19-JUN-2008
From 19-JUN-2008 08:00 to 20-JUN-2008 06:00
EXM: 38
GROUNDED: 32
Plz note that this result is required because in our company the shift starts from 08:00 AM and ends 07:59 AM next day
I hope you will be more clear now and there is no confusion anymore.
Plz let me know if you still confused.
Brgs,
Similar Messages
-
Can you add to the Lightroom an ability to process several raw files with the same content but with different exposure into the single picture?
Base raw files can be given with exposure bracketing during shooting, for example.
The goal - to get maximum details in darks and lights (if we use the "ligths recovery" or "fill lights" we lose the quality because raw file just have no all required information).
The similar (but not the same, only the idea) thing - is High Dynamic Range Photography in Adobe Photoshop
Thank youThe plugin LR/Enfuse does this already. And of course Photomatix have a plugin available for Lightroom. This essentially amounts to pixel editing, which is beyond the range of Lightroom's metadata editing.
-
To create multiple files with same content but with different names
Hi SapAll.
here i have got a tricky situation on Idoc to File Scenario.
in my interface of an Idoc to file ,there is requirement to create multiple files with different file names but with same content based on one Idoc Segment.
which means there will be one Zsegment with two fields in the idoc,where one field with (content refers to the name which file name should start with .so lets say if this segment is repeated for 3 times then PI should create 3 files in the same directory with same content but with different file names (from the filed).
so here for now iam using one reciever file communication channel.
can any body give me the quick answer.
regards.
VarmaWhat do you mean by different names?
when i make proper setting in the Receiver Channel....on how to create the filename (what to append) like add Timestamp, counter, date, messageid.....even in this case you will ahve file with different names and that too from same File channel.
You can perform multi-mapping in XI/ PI and then your File channel will place the files in the target folder with relevant names. You cannot use Dynamic Configuration with Multi-Mapping!
If you intend to use different File channels, then do the configuration as required (normal)...even over here you can follow multi-mapping.
Do not use a BPM!
Regards,
Abhishek. -
How to sync two IPhone with one PC , but with different applications
How to sync two IPhone with one PC , but with different applications ?
We have two IPhones , but one PC , we want to sync separately , is that possible ?Absolutely, connect each phone, select what content you want on each phone, then hit the sync button. iTunes will keep everything straight, by device, upon subsequent syncs, including separate backups.
-
Two ODSs share the same InfoSource but with different updata mode load?
We've got two different ODSs (ODS1 and ODS2) for two respective clients (client 1 and client 2). Client 1 has already going alive and in the InfoPackage, we only pick up ODS1 (Client 1) as feeding target and we have conducted initial load and several times of Delta loads for ODS1 (data load daily). But now we are going to start to load data to ODS2 (Client 2) and at the same time we will have to continue our delta load to ODS1.
It could not be possible that the two ODSs will be feeded data with different pace (ODS1: continue delta load, ODS2: initial load) if they share the same InfoSource. Then what's the best way to resolve this issue?
Thankshi Pradip,
Tell you a bad news that the solution doesn't work on two of the EBP (a source system which is similar to R3, we've got 4 EBP ODS/InfoSources, but two of the four don't work with the last step listed below) ODSs/InfoSources. The steps I took on production are:
1. Conduct Full Repair data load to ODS2;
2. Delete init option of ODS1 from Scheduler menu;
3. Run Init without data transfer to set delta pointer for both ODS1 and ODS2.
But the last step to run Init without data transfer has taken 1 whole day and eventually becomes red since it takes so long time to set delta pointer.
When I said our solution worked is that I conducted the test on our GL ODS and the Init without data transfer took about 1 hour to finish.
Also when we conduct the last step to do the Init without data transfer to click Start button to set pointer, a msg box titled "Activate ODS Data" pops up saying that "No requests have been selected for activation. Do you want to make a selection, or activate all the requests?" with buttons "Activate all requests", "Select requests" and "Cancel". If clicking the button "Select requests", another msg box pops up to prompt to input a Date range, we didn't input any date range, just click continue, then the Init without data transfer will run forever!
Thank
Message was edited by: Kevin Smith -
How to run the APD programmatically with different query variables
Hi All
I have a requirement to run a APD with a query in it programmatically on a series of posting periods from 1 to 10 I want to run the APD once for each posting period.
Any idea how I can do this.
Thanks
KarenKaren,
Create a variable on posting period in the query.
in tcode RSRT, choose the query name , here you have the option of creating query variants. create different variants and save it.
In APD, when you choose the query, you have the option of choosing query variant, choose the variant you created in rsrt.
You can automate by including the APD with different query variants in a PC.
Sharat -
GPO task run as user but with administrator right?
We need to change a Java setting in the appdata folder of a restricted user on hundreds of computer.
As they use different user but on local profile, we need to be able to run a task as User but be able to write in a folder that the user don't have access to.
We try to use the Schedtask and run it at the current logon user with the "Run with highest privileges" but this doesn't seem to work
Any input?> We try to use the Schedtask and run it at the current logon user with
> the "Run with highest privileges" but this doesn't seem to work
Highest privileges is only meaningful when the user is member of local
admins - then (and only then) the task will run with admin privs.
Might be a solution to use GPP files or GPP INI-Files or something like
that. These can run in user GPOs but with system privs.
Martin
Mal ein
GUTES Buch über GPOs lesen?
NO THEY ARE NOT EVIL, if you know what you are doing:
Good or bad GPOs?
And if IT bothers me - coke bottle design refreshment :)) -
We have iPad and ipad2 with one email address but two owners. How can we share purchases, receive same email messages but have individual accounts at the same time? Can we have same Apple User ID with different passwords? Hepl!
Aside from the fact that we have hijacked this thread - which we really shouldn't do - you would probably be better off posting questions or seeking advice in the iCloud portion of the Apple Support Communities. I'm sure that there are a lot of more experienced iCloud users on that site than I am.
I'm not a big believer in iCloud at this point, so my experience with it - other than downloading past purchases - is really pretty limited. I would not want to steer you down the wrong path.
However, here is the Apple iCloud support website that is loaded with all sorts of information and links to even more information. This will get you started anyway ....
http://www.apple.com/support/icloud/ -
How can I access a response file on the same computer but with different login?
When trying to access a response file on the same computer that was used to set it up, but with a different login, I get an error message that the network resource was not found. How can I retrieve the responses on the same computer but under a different login/username?
The response file is associated with a specific login (as determined under Edit > Preferences > Identity) so you cannot retrieve it if you're using a different login.
-
Several layered effects of the same kind but with different adjustments for the same layer
Hi,
I wonder if it there is an easy way to have several different instances of e.g. glow or bevel and emboss on the same layer.
I know I can achieve this by using smart objects or a duplicate layer with zero blending.
I just wondered if there is a way to do this directly in the layer effects.Hi emil emil,
thx for your answer!
I wasn't even refering to different objects on the same layer, btw. it would be enough if I was able to layer e.g. different bevel and emboss on top of each other (With different colors, softness and size.) But I guess the answer remains the same. -
Running Totals and Formulas with Cross Tabs
Hi,
I'm using Crystal Reports 2008 and am having two issues using Cross Tabs.
The first is that I want to have two crosstabs. They both will have a common Y axis (Oppourtunity.Sales Rep), and on the Y Axis I want one to show all (Opportunity.Create Date) where (Opportunity.Staus = Won) and the other where (Opportunity.Staus = In Process), but I can't figure out how to contruct the formula to return this result.
The other issue, is that in addition to summarizing based on Sum (Opportunity.Expected Revenue), I would also like to create a running total to show the cumulative (Expected Revenue) Week over Week.
Any direction would be fantastic.
Thank you,
MichaelPlease go through the SAP Notes listed here which would help you how to create mannual running totals in crosstab
[https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_ossnotes&query=runningtotalin+crosstab&adv=true¬e_number=&component=&sdn_updated_on_comparator=GE&sdn_updated_on=&sortby=cm_rnd_rankvalue]
Regards,
Raghavendra -
Project stock exist in a plant and WBS but with different company code
Hello,
As I know I can not create a PO in company A, but was assigned to a WBS maintained in company code B. The system will check if the WBS getting the same company code with the PO, and pop up the error message if the company code was differect.
But seems the project stock could exists in a plant but assign to WBS was maintained with different company code. For example, A material stock was in plant A assigned to company code A, and it is also assigned to WBS belong to company code B.
Any one know it is correct?
Thanks!I knew crossing company code to assign WBS element to PO is not allowed since i got the error message, and I think it's reasonable, cause the expense from the project PO should post to the same company code through the WBS element.
But why for the inventory crossing company code is allowed? The stock in plant A belong to company code A, was assigned to WBS element B belong to company code B. That means the inventory is in the GL balance of company A but under the profit center belong to company B. How to understand it? I think it's wrong -
New Macbook pro retina but with different keyboard ?
Can I buy the new macbook pro retina 13' in HK but with a French keyboard ? I don't find the option online.. thanks!
No computer is fault free but Apple MBPs have a good track record. In those cases where problems do arise, Apple has the best support in the industry.
A MBP with 4 GB RAM with the SSD storage should be adequate for your needs.
lsmoondancer01 wrote:
P.s. On Apple's site I found a refurbished late 2013 model of the MacBook Pro Retina 13 with all of the same specs as listed above (4GB, not 8GB), running OS X (doesn't say which one) but for a bit less than a brand new one. Is this the same model as what they're currently selling new in their store or did they just upgrade everything to match what is being offered in the current "new" model?
The latest MBP models came out in October 2013, so it will be the same, with the same warranty and telephone support. The difference will be that the price will be less and it will be delivered in a plain white box.
I have purchased three MBPs from the refurbished section. I have never been able to detect any cosmetic differences and will go that route again.
Ciao. -
I need to reinstall osx on my mac but with different apple id ?
hey,
i need to resinstall osx on my macbook but with a different apple id than the one which i used to install mountain lion is there any way i can do it ?Welcome to Apple Support Communities
Unless you purchased OS X Mountain Lion with that Apple ID, you can't. You have to use the Apple ID used to purchase OS X Mountain Lion, or you won't be able to install Mac OS X -
Running fullscreen on monitors with different aspect ratios
I am trying to run a program in fullscreen on a projector. It works fine on my computer, but the background image appears stretched when I run it on a projector with a different aspect ratio. How can I run it as to prevent this?
This is how the code looks:
@Override
public void start(Stage primaryStage)
this.PrimaryStage = primaryStage;
this.PrimaryStage.setFullScreen(true);
......which runs with this CSS file:
#background{
-fx-background-image: url("background-full.png");
-fx-background-repeat: stretch;
-fx-background-position: center center;
-fx-background-size: auto 100%;
-fx-background-color: black;
}Don't stretch the repeat
-fx-background-repeat: no-repeat;
AND
-fx-background-size: cover;
Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.
Or
-fx-background-size: contain;
Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area.
Contain will provide a kind of letter box effect like watching an old 4:3 tv show a widescreen 16:9 TV.
Cover will fill the screen with the image bug clip some of the image if the screen and image aspect ratios don't match.
Maybe you are looking for
-
Mail-how to send to a list without entering ea as individual contact?
I sent email reminders monthly to a group of about 20 email addresses. I don't even know most of the people & there are changes each month with additions & deletions. In Eudora on my old Dell I just had a contact with the whole list in it. Then when
-
Adobe Reader Installation encounters an errror: Error 1303. The installer has insufficient privileges to access this directory. C:\Program Files(x86)\Adobe\Reader 9.0\Resource\Font\PFM The installation cannot continue. Log on as an administrator or c
-
How to read the content of html page? (written in JSP)
The same with readContent("http://www.urcompany.com/readPage.html")
-
Scientific Notation to Integer?
I have a string like 1.780657E7 that I need to convert to an integer. I think that might be too big for Integer, so maybe BigInt would be better. Anyway, I can't figure out how to do this! I guess I could write my own method, but I'm sure it's alread
-
Document not open on first Click
Hello All, I am facing a pecuilar problem. I am using the following tag to display the user manual to the user. <!--<a href="docs/user_manual.pdf" target="_blank">User manual</a> --> And the user_manual file is uploaded in the mime Objects. When I cl