Days off

Hello

I have the following table

create the table leaveavail as

(select 1 empid

TO_DATE (October 21, 2014 12:00 ',' dd/mm/yyyy hh24 ') as leavefromdate,

2 as fromdatetype,

TO_DATE (October 25, 2014 12:00 ',' dd/mm/yyyy hh24 ') leavetodate,.

1 as a todatetype of the double

)

here

fromdatetype, todatetype means

If full 0 day,

If 1 morning

If 2 afternoon.

In the table above, the '1' employee is therefore leave the afternoon of 21/10/2014 until the morning of the 25/10/2014

so on 21/10/2014 and 25/10/2014, the employee is on a half-day leave. all dates between the employee is on sick leave throughout the day.

I want only the data above table divided to corresponding dateswith leavedate types as follows.

EmpID leavedate leavetype

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

21/10/2014 1, 2

22/10/2014 1, 0

23/10/2014 1, 0

24/10/2014 1, 0

1 25/10/2014 1

.

Help, please

I use oracle 10g

Hello

Here's one way:

SELECT l.empid

s.shiftdate

More LARGE (l.leavefromdate, s.shiftstarttime) AS leaveformtime

, The LEAST (l.leavetodate, s.shiftendtime) AS leavetotime

CASE

WHEN l.leavefromdate = GREATEST (l.leavefromdate, s.shiftstarttime)

THEN l.fromdatetype

WHEN l.leavetodate > LESS (l.leavetodate, s.shiftendtime)

THEN 0

Of OTHER l.todatetype

END AS leavetype

OF leaveavail l

s shiftdetails

WHERE l.empid = s.empid

AND l.leavefromdate<>

AND l.leavetodate > s.shiftstarttime

;

Tags: Database

Similar Questions

  • Hald day off in the management of absences in R12

    Hi gurus,

    Can I know how can we use half-day off in R12 with functionlity standard? We do not use OTL. How can this be achieved and if you have a code example can you please share it.

    Also if you can share the calculation of term of BG Absence code to create exceptional days for weekends and holidays.

    I really appreciate your help on this.

    [email protected]

    Thank you.

    You can time in formula lack BG, if value is in decimal form, you can check the validation and can return a decimal value as time.

    Thank you

  • Wrong date. A day off. Does not take into account leap years.

    We don't want the date on my iMac. It is a day of rest. On March 3, it shows March 2. Of course, it didn't take leap years into account. When I tried to change it after you have unlocked the date/time, he wouldn't let me to change the date. It is automatically defined under Apple Americas/U.S. (time.apple.com site), but the automatic setting is false. How do override us the auto setting or have them repaired?

    Oops! My watch was the one who was wrong. Apple is very well. Sorry about that.

  • Bug: birthdays synced from Exchange are 1 day off [de-version]

    Hi guys,.

    I have a pretty annoying bug here.

    Location: Defy bought in Germany with all the German settings (UTC + 1).

    I have contacts in Exchange sync on the Defy that contain birthdays (and other events). I also have contacts with birthdyas coming from Facebook.

    Using the search application"standard" contact stock, the Facebook birthdays are displayed correctly, but those coming Exchange is all one day: they are one day too early. " This is also reflected in other applications of third that access the built-in contact database. The date is different from 1 day to what I put in outlook.

    I dug deeper and installed the touchdown, an Exchange/contac-e-mail client that keeps its own list of contacts synced directly to Exchange. Here, dates are displayed correctly.

    It seems as if synchronization of contacts from Exchange, the device is not correctly interpreters dates.

    This is probably a confusion with the time zones? However, it is rather annoying - I called friends a day earlier twice now :-)

    Anyone know anything about this?

    Thanks in advance,

    Southy

    Exchange is where I fixed it.

    One of 2 things usually done. Just the touch of opening and saving. Or the break contact, change B-day, save and change back and save again.

    There is a weird bug of ActiveSync plaguing smartphones for years. As far as I know it is resolved in Exchange 2010. But if you google "Exchange Sync Birthdays out of one day" you will see it poisons everything that syncs with Exchange to iPhones to Google accounts to other Android devices, same blackberries. Microsoft should fix this problem.

  • Calculate the number of days off weekends


    Hi all

    I have a requirement where I have to calculate the difference between two dates, excluding weekends and holidays. Is there a way I can do it in OBIEE analysis.

    Any help would be appreciated.

    Thanks in advance!

    Check it for weekends cool - bi.com

    For the holidays, you will need to customize you the size of the day

    check if help

  • Help me please! Photoshop has decided to take a day off

    Help me! whenever I try to open a file, nothing happens...

    Fixed it got... I think I just needed to update. Geez. Thank you very much

    Sent from my iPhone

  • Script to remove 30 days turned off of the guest virtual computer in vCenter automatically and the user on this subject by e-mail

    Hi all

    I'm looking for a script that can automatically remove power vm comments which have been stopped for more than 30 days off. Now I'm under this

    $IgnoredVMs = "windows7."

    $vms = get - VM | Name - descending sort

    foreach ($vm to $vms)

    {

    $DecommedVMs = ($vm |) Where {$_.} PowerState - eq "PoweredOff"} | Where {$_.} Name - notmatch $IgnoredVMs} | Select Name, LastPoweredOffDate). Sort - Object - property LastPoweredOffDate)

    }

    and then I run it manually

    Remove-vm $DecommedVMs - deletepermanently

    Things, it is that I have more than 1000 comments vm in my environment and we create & many virtual shutdown invited every day. And since we have a retention period of 30 days per vm we cannot remove them as soon as they stop. So I'm looking for a script that verifies any vm guest that is off for more than 30 days and remove them automatically automatically and e-mail user guest vm is eliminated.

    Thank you

    Rama

    Try something like this

    $vms = Get-VM | where {$_.PowerState -eq "PoweredOff"}$vmPoweredOff = $vms | %{$_.Name}$events = Get-VIEvent -Start (Get-Date).AddDays(-30) -Entity $vms |   where{$_.FullFormattedMessage -like "*is powered off"}$lastMonthVM = $events | %{$_.Vm.Name}$moreThan1Month = $vmPoweredOff | where {!($lastMonthVM -contains $_)} 
    
    $moreThan1Month | Remove-VM -DeletePermanently -Confirm:$false$vmNames = $moreThan1Month | Select -ExpandProperty Name
    
    Send-MailMessage -From [email protected] -To [email protected] -SmtpServer [email protected] `-Subject "Removed $($moreThan1Month.Count) VM" -Body ($vmNames | Out-String)
    
  • Any instance of time displayed through Firefox is 5 hours off the coast (+) (IE Comcast call time logs, each page to print, etc.). IE and other browsers display correctly as they are all the time on my computer settings. Help, please.

    Any instance of time displayed when you use Firefox see the days off by + 5 hours. I'm in Philly so use felt all other settings are correct on the computer. For example the call time display to Comcast and every foot of page log displays time + 5 hours. I have not found anything useful in Web search. I always check after each update for Firefox but the problem persists.

    Try http://kb.mozillazine.org/Time_and_time_zone_settings

  • Out of eligibility of the days

    Hello


    I have the following table ATTENDANCE

    DATE

    OFF

    UNPAID

    21/07/2015

    unpaid

    22/07/2015

    unpaid

    23/07/2015

    unpaid

    24/07/2015

    off

    25/07/2015

    unpaid

    26/07/2015

    unpaid

    27/07/2015

    28/07/2015

    29/07/2015

    off

    CREATE TABLE PRESENCE AS

    (

    SELECT 1 EMPID, DOUBLE TO_DATE('21/07/2015','DD/MM/YYYY'), 0 OFFDAY, 1 OUTSTANDING OF ANY UNION RDATE

    SELECT 1, TO_DATE (JULY 22, 2015 ',' DD/MM/YYYY ""), 0, 1 DOUBLE UNION ALL

    SELECT 1, TO_DATE (JULY 23, 2015 ',' DD/MM/YYYY ""), 0, 1 DOUBLE UNION ALL

    SELECT 1, TO_DATE (JULY 24, 2015 ',' DD/MM/YYYY '), 1, 0 DOUBLE UNION ALL

    SELECT 1, TO_DATE (JULY 25, 2015 ',' DD/MM/YYYY ""), 0, 1 DOUBLE UNION ALL

    SELECT 1, TO_DATE (JULY 26, 2015 ',' DD/MM/YYYY ""), 0, 1 DOUBLE UNION ALL

    SELECT 1, TO_DATE (27 JULY 2015 ',' DD/MM/YYYY '), 0, 0 DOUBLE UNION ALL

    SELECT 1, TO_DATE (28 JULY 2015 ',' DD/MM/YYYY '), 0, 0 DOUBLE UNION ALL

    SELECT 1, TO_DATE (JULY 29, 2015 ',' DD/MM/YYYY '), 1, 0 OF THE DOUBLE

    );

    For each day offday = 1 means that it is a stop for the employee.

    and unpaid = 1 means that it is an unauthorized absence and a full day is unpaid.

    Here a rule to give OFF an employee is that, in previous 5 days that his unpaid account must be not greater than or equal to three, or its judgment day become outstanding.

    so I used after application to do the same thing in a single select here

    Select

    EMPID,

    RDATE,

    -case offday = 1 and

    Sum (UNPAID) over (partition by empid arrested by rdate rows between 5 preceding and 1 preceding) > = 3

    then 0

    to end another OFFDAY as offday.

    -case offday = 1 and

    Sum (UNPAID) over (partition by empid arrested by rdate rows between 5 preceding and 1 preceding) > = 3

    then 1 other UNPAID end as non-PAID

    ATTENDANCE;

    The result is

    EmpID date off unpaid

    121/07/201501
    122/07/201501
    123/07/201501
    124/07/201501
    125/07/201501
    126/07/201501
    127/07/201500
    128/07/201500
    129/07/201510

    But the employee has already lost eligibility for the day off, 24, his previous outstanding account 5 days 29 becomes three and he is not eligible for the 29 stop too.

    expected results

    EmpID date off unpaid

    121/07/201501
    122/07/201501
    123/07/201501
    124/07/201501
    125/07/201501
    126/07/201501
    127/07/201500
    128/07/201500
    129/07/201501

    Is it possible to get this output from a query? or do I have to use a procedure that checks and update each lines while I'll get the updated records updated?

    Help, please

    I use oracle 10g

    Hello

    Krishna Devi Vinayaka says:

    Hi Karthik,

    Thanks for the reply that he.

    Why are you ordering records by empid only?

    It must be ordered by rdate to rethink the role of the previous lines? ...

    I don't know that it was a typo.  It is never logical PARTITION BY and ORDER BY the same expression in any single function.

    You can't solve this problem with only analytical functions.  This is a recursive problem.  Analytical functions can get correct results ranked N based on the raw data on the N-5 through N - 1 lines, but in this problem, the results ranked N depend on derivatives results (not the raw data) on the N-5 lines by N - 1.  You can't tell if July 29 is considered as not paid until you have determined if July 24 is unpaid.  You can probably do it using CONNECT BY or with a recursive (available in Oracle 11.2 and upwards) WITH clause, but I think that the best solution in Oracle 10 is MODEL.

    Here's a way to do it:

    SELECT empid, rdate, offday, unpaid

    ATTENDANCE

    MODEL PARTITION BY (empid)

    DIMENSION OF (rdate - MIN (rdate) OVER (PARTITION BY empid) LIKE d_num)

    MEASURES (rdate

    offday

    unpaid

    )

    REGULATION SEQUENCE

    (default [any] ORDER BY rdate = BOX)

    WHEN not paid [cv()] = 1

    THEN 1

    WHEN offday [cv()] = 1

    AND the SUM (unpaid) [d_num (cv-5) AND cv()] > = 3

    THEN 1

    0 OTHERWISE

    END

    , offday [any] = BOX

    WHEN not paid [cv()] = 1

    THEN 0

    Of ANOTHER offday [cv()]

    END

    )

    ORDER BY empid, rdate

    ;

    I guess not paid is always 0 or 1.

  • Premiere Pro CC - worked for a few days, now will not boot

    Premiere Pro has worked in a few days (ocationally gel, but nothing major) and now it's launch.

    Event Viewer says:

    The program Adobe first Pro.exe version 9.0.2.6 no longer interact with Windows and was closed. To see if there is more information about the problem, check the history of the problem in the control of security and maintenance Panel.

    Process ID: 269c

    Start time: 01d0fec8b70cb72b

    Termination time: 57

    Application path: C:\Program Files\Adobe\Adobe Premiere Pro 2015\Adobe first Pro.exe CC

    Report ID: 3dd852c8-6b77-11e5-bf54-a4db300c9207

    Faulting full name of the package:

    ID of the failed package-parent application:

    The launch of the program, I see the PR splash screen, but it never gets past that point. I uninstalled and re installed (the one used to make it work again briefly...) now I can't start at all.

    The fixed!

    Windows 10 had two updates KB3081449 and KB3081448 that must be uninstalled.

    Explorer on Windows 10 - Super user

    Everything works fine now... but I lost a good 10 days off of my 30 day free trial

  • Bad birthday with siri in macOS Sierra

    When you use Siri one my Imac (with macOS Sierra) and ask for a birthday, the answer is always the day before, as it should. Ask anyone "xy" with a birthday in contacts in the 24. in June he replys 23. from June.

    I use the Sierra macOS German language pack and I am located in Europe it's maybe one

    temporal server problem?

    PS: ask siri on iphone I have the correct answer...

    Same problem here on a Dutch system, see: anniversary of Siri a day off

  • Suggestions of Siri - Recent Contacts

    So I was checking the recent contacts in my Suggestions Siri and I noticed one of the list I have no recollection by contacting at least. However, this person's name was among a list of people I have had interaction with the last 24 hours.  Is there something I'm missing here? Is this something that happens frequently? Is this a bug? Is there something about the search algorithm, I do not understand?

    The reason for my concern is that I want to do that I was not black, and this person or maybe someone got a hold of my phone and contacts without my knowledge. If this is the case then I have a big problem to deal with.

    The proposed contacts are more than just a simple "recent contacts". The contacts that appear depend on not only who have contacted you recently, but also on your location and time of day. For example if you always text your boss during the days of the week when you are at work, your boss will be there Tuesday if you are at work, even if you have not sent a text message their show recently. If you had a day off and have been to the beach, even if you approached your boss the day before, their contact is not necessarily show.

    At present, only four contacts suggestions Siri is someone I have texted or called in the last 72 hours. However, they are all people I have contact usually around this time of the day (if I do) and from this location.

  • where is the trash on the screen email Windows 8

    I'm just getting used to Windows 8 and Mozilla Thunderbird emails (I'm also in my 70 so patient with me!) I deleted quite a few emails and I'm used to a button "purge" on my old e-mail on Windows 7 system. I have trawled through all the support sites and saw the garbage can mentioned but I can't find it on my screen! So where is it? A big thank you to our volunteers who can help you.

    E-mail POP accounts have a folder 'Deleted' for deleted messages.

    Re: think it's a Pop e-mail account, even if the server settings do not present this.
    The use of information provided in my previous post, you should see something like the image below.
    Server type: is at the top.
    Your server name will be different.

    If you use the same settings:
    'Leave messages on the server"- which leaves a copy on the server.
    "no more than xx days"-will remove e-mails more than xx days off of the server.
    "Until I have delete '-will delete emails you delete in Thunderbird off the server.

    Any email that you delete will be "marked as deleted" and from your point of view, email disappears from the record, and reappears in the folder "deleted".
    In reality, it is always in the file, which is hidden from view and "marked as deleted.
    When you record 'compact', any trace of deleted emails is erased.

    to compact a file:
    Right-click on a folder and select "compact".

    to compact all folders:
    File > Compact folders

    Even the "Deleted" folder must be emptied and compacted on a regular basis as well.
    Compaction - what it does and why it is important:

  • Re: Satellite Pro A120 is no sound

    My father made me a laptop TOSHIBA Satellite Pro A120 PSAC1E-0QJ052EN the other day off a friend.

    He used to have Windows XP, but a friend of my father installed Windows 7. When I try to play music or watch videos audio meter at the bottom right shows action but not his fate.
    I tried to download the new drivers and I googled the problem, but I can't get the audio to work.

    I'd appreciate any help I need sound for a school project.
    -Tom

    > watch action but no sound.
    When you open reading devices in sound properties option speakers are set by default?
    You can hear sound if you are using the headset or headphones?

  • Satellite L500 19 X battery discharge when not in service

    My new and practically unsused portable is its battery at the rate of 10% in 48 hours when it is turned off and not in hibernation mode. To remove the battery is losing 2% within 48 hours.

    I fully charged the battery to 100% and closed while still in charge.

    There is no doubt in my mind that the battery is discharging when mounted and only lose a small amount of charge when removed from the laptop.

    All users have the same problem. The result is that, in a week, the battery will discharge some 35%, what I find unacceptable.

    Hello

    I think that's not bad boyfriend
    The battery will always be s discharge a little even if the laptop is not running.

    Take a look in the user manual.
    I did and found this:

    When you turn off your computer with fully charged batteries, the batteries keep following approximate data periods;

    Battery pack 12; 2 days ("sleep mode"); 20 days (shutdown mode)
    Battery pack 6. 1 day ("sleep mode"); 10 days (off mode)
    Battery pack 3. 0.5 days ("sleep mode"); 5 days (off mode)

    Always check the software suite / settings of the bios in order to decrease the discharge of the battery:
    -sleep / recovery mode hibernation etc. will reduce the time that the battery is drained considerably
    -always check the weather Wake-On-Lan or Wake on HDMI is enabled
    -always check the weather USB sleep & charge is activated

Maybe you are looking for