How can i use this expression in DECODE function?
My PNO table formart is
PNO PDate PCount
P001 08/27/05 09:45 20
P001 08/27/05 09:50 10
P002 08/27/05 03:40 20
P003 08/28/05 11:00 20
P003 09/28/05 10:00 20
P003 08/27/05 11:00 10
P003 09/27/05 04:00 50
I want to display total pcount for shift1(morning) and shift2(evening) & the date is 08/27/05
PNO Shift1(08/27/2005 08:00 to 12:30) Shift2(08/27/2005 02:00 to 05:30)
P001 30 0
P002 0 20
P004 10 50
So for shift1 condition is:
pdate>=08/27/2005 08:00 and pdate<=08/27/2005 12:30
So for shift2 condition is:
pdate>=08/27/2005 02:00 and pdate<=08/27/2005 05:30
If i tried to give this expression in decode function , its not working.
Please give me the sql query to solve this problem.
Millions of thanks in advacne
forgot to paste the output for a given date.
SQL> create table pno
2 (pno varchar2(32)
3 ,pdate date
4 ,pcount number)
5 /
Table created.
SQL>
SQL> insert into pno values('P001', to_Date('08/27/05 09:45', 'mm/dd/yy hh:mi') ,20)
2 /
1 row created.
SQL> insert into pno values('P001', to_Date('08/27/05 09:50', 'mm/dd/yy hh:mi') ,10)
2 /
1 row created.
SQL> insert into pno values('P002', to_Date('08/27/05 03:40', 'mm/dd/yy hh:mi') ,20)
2 /
1 row created.
SQL>
SQL> insert into pno values('P003', to_Date('08/28/05 11:00', 'mm/dd/yy hh:mi') ,20)
2 /
1 row created.
SQL> insert into pno values('P003', to_Date('09/28/05 10:00', 'mm/dd/yy hh:mi') ,20)
2 /
1 row created.
SQL> insert into pno values('P003', to_Date('08/27/05 11:00', 'mm/dd/yy hh:mi') ,10)
2 /
1 row created.
SQL> insert into pno values('P003', to_Date('09/27/05 04:00', 'mm/dd/yy hh:mi') ,50)
2 /
1 row created.
SQL> select pno,sum(pcount) "Morning Shift Count"
2 from pno
3 where to_char(pdate, 'mm/dd/yyyy hh:mi') >= '08/27/2005 08:00'
4 and to_char(pdate, 'mm/dd/yyyy hh:mi') <='08/27/2005 12:30'
5 group by pno
6 /
PNO Morning Shift Count
P001 30
P003 10
SQL> select pno,sum(pcount) "Evening Shift Count"
2 from pno
3 where to_char(pdate, 'mm/dd/yyyy hh:mi') >= '08/27/2005 02:00'
4 and to_char(pdate, 'mm/dd/yyyy hh:mi') <='08/27/2005 05:30'
5 group by pno
6 /
PNO Evening Shift Count
P002 20
Similar Messages
-
I bought used iPhone and on this iPhone I'm not able to make new account on i Cloud'. How can I use this iCloud's on used iPhone Please help me
When I logging there it told me that maximum no of iCloud's Account already activated on this iPhone.
Please help me how can I open new iCloud's account on this iPhone
Regard
Faiz khanSet up the account using a desktop or laptop, then sign
into that account on your iPhone.
I am not aware of any method around the restriction once
the maximum has been created on any individual iPhne. -
I have a limited storage in iPhone so i bought 20g iCloud. how can i use this iCloud storage in my device to store music and photos?
Welcome to the Apple Community.
You could sign up for iTunes match and use iCloud photo library with optimisation enabled. The later will keep optimised photos on your device and iTunes match will let you access your whole collection and make room for newer content by removing older unplayed items. -
How can i use this function module
Hai
How can i use this function module /SAPHT/SALES_ORDER_READ, already apply the some parameters in this function module, but it shows the error , please tell me, how to declare the parameters in this function module ,
thanks
neelimaHi
For a particular sales order,you have to pass the order number and the item number in the sales order.
It will display the rest of the values which u can capture them using internal tables.
Regards,
Vishwa. -
i have a iphone 4,4.3.5 bought from uk i used this phone in uk,now i am in india how can i use this in another networks without jailbreak such type of softwares
Where did the phone come from as most of the UK carriers unlock phones, but the fact that you are now abroad may be a problem.
-
I purchased a iphone i USA. How can i use this iphone in india with vodafone.
I Purchased a iPhone 5s in USA. How can I use this phone in India with Vodafone.
<Edited By Host>First, the iPhone would need to be unlocked. That would depend on where you bought it. Next, the North American phone would not work with all of the networks outside of the US. Also, the warranty for the device is only good in the US, so if you have a problem with the phone, you would need to bring it back to the US to an Apple Store. Where did you purchase the phone?
-
I purchased Adobe Illustrator CS2 on CD many years ago and now i have bought a new iMac computer it won't let me install from the CD's. How can i use this product on iMac ?
Because the Nano was previous synced to another comuter/iTunes library.
See the following:
Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities -
How can i use this sript and loade another movie?
Hi there, i used the following script to load a movie from the server;
var request:URLRequest = new URLRequest("url string");
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);
How can i use this sript and loade another movie? Can someone help me please?
[edited by moderator]Sir, I changed it from:
var request:URLRequest = new URLRequest("http://agusandelsur.gov.ph/downloads/pdrrmo/agusan_del_sur/StaJosefa/Movies/Dir.swf");
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);
to
var request:URLRequest = new URLRequest("http://agusandelsur.gov.ph/downloads/pdrrmo/agusan_del_sur/StaJosefa/Movies/Warning.swf");
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);
When i expord the movie i get the following error.....
Scene 1, Layer 'Layer 3', Frame 1, Line 6 1151: A conflict exists with definition request in namespace internal. -
How can I use this forum?
Does anybody here can tell me how can i use this forum???
What do you want to do? What is your question?
Randy -
How can I use this account without specify credit cards, only for free applications ?
How can I use this account without specify credit cards, only for free applications ?
Click here and follow the instructions.
(94222) -
HT1515 How can I use Airport Express (1st generation) with OS X Mavricks?
How can I use Airport Express (1st Generation) with OS X Mavericks?
1st Generation AirPort Express will work fine with Mavericks.
Are you sure that you have a 1st Gen Express?
Check the model number on the side of the Express. 1st Gen is A1264.
If you see A1084 or A1088, these are much older versions of the Express that were sold long before Apple began to use the Generation naming with "n" wireless devices in 2007.
Mavericks will not support the A1084 or A1088. Use another Mac running Leopard, Snow Leopard, or a PC if you need to administer the older Express. -
I have an apple 4 given to me by my cousin from japan but the phone is lock by japan sotfbank, how can i use this phone here in the Philippines network provider? thanks
Only the carrier an iPhone was sold as carrier locked with can officially unlock the iPhone. It is my understanding that Softbank in Japan does not unlock iPhones.
-
good day..i have my iphone 4 now..am here in the philippines...how can i use this unit using my smart simcard here..thank you.
Is your iphone officially unlocked?
If not, then you cannot use it there. -
What is car play ? how can i use this?
what is car play ? how can i use this?
You can use CarPlay if your new car model supports it.
http://www.apple.com/ios/carplay/ -
Hi I have itunes UK on my lap top and my daughter has been bought an Itunes USA gift card how can I use this please?
Gift cards can only be used in the country in which they are purchased - so in order to use a US gift card you would need to have a US iTunes account.
Maybe you are looking for
-
FM for Products releated to a Category
Hi All, Can anyone of you tell me the Function Module to retrieve the list of Products if a Product Category is specified, like in that what we search in COMMPR01 transaction. Regards, Jaggu
-
I need help updating music on my new version of iTunes, anyone know how to? for iPhone 4
i have downloaded the latest version of itunes on my laptop and i want to burn the music on it and uprgrade it so does anyone know how to? on the old itunes version was just simply an update button at the bottom right hand corner of the screen? any h
-
Well I had the old blackberry software the 7.0 and the I seen there was an update so I done it through the app on the phone 'it was pre-installed' and it said it may take up to two hours to complete two hours went past and It was still on 17% so I di
-
Good online stores to order spare parts?
I need to replace the rear processor cage fan because it's noisy. I have searched the Internet for online stores that sell spare parts for Mac computers (specifically 2010 Mac Pro Quad Core 2.8) and... let's say the stores I have found do not appear
-
Hi, I have the following query: SELECT e.emp_id emp_no, e.emp_name emp_name, eop.ep_hourly_rate hr_rate, ou.ou_name org_unit, count(eoa.ea_emp_id) no_activities, sum(eoa.ea_planned_hours) planned_hours, sum(eoa.ea_planned_hours) * eop.ep_hourly_rate