Unpaid and out of combination

Hello

In our payroll, there is a rule as follows.

If an employee unpaid for three consecutive days before a day off, so it cannot be turned off and its judgment will be treated as unpaid.

Following table shows no outstanding balance for a day if not paid = 0. If it is 1, it means unpaid full day.

24/10/2014 is an offday. but as it is unpaid on the previous three days, 23,22,21 then it is not eligible for offshore.

so to the put, this day of rest will be 0 and not paid would be 1.

How can I get this output in oracle 10g?

create table of participation as

(

Select 1 empid, to_date (' 21/10/2014 ',' dd/mm/yyyy') as prdate, 1 unpaid, 0 outside the union double all the

Select 1 empid, to_date (' 22/10/2014 ',' dd/mm/yyyy') as prdate, 1 unpaid, 0 outside the union double all the

Select 1 empid, to_date (' 23/10/2014 ',' dd/mm/yyyy') as prdate, 1 unpaid, 0 outside the union double all the

Select 1 empid, to_date (' 24/10/2014 ',' dd/mm/yyyy') as prdate, 0 unpaid, 1 stop of all the double union

Select 1 empid, to_date('25/10/2014','dd/mm/yyyy') as prdate, 1 outstanding, 0 out of double

)

Power required

===================

EMPID UNPAID OUT OF DATE

===========================================

1                     21/10/2014                1                     0

1                     21/10/2014                1                     0

1                     21/10/2014                1                     0

1                     21/10/2014                1                     0

1                     21/10/2014                1                     0

===========================================

Do you mean like this?

SQL > ed

A written file afiedt.buf

1 with attendance (empid, prdate, unpaid, off) until)

2 Select 1, to_date (' 21/10/2014 ',' dd/mm/yyyy'), 1, 0 of all the double union

3 select 1, to_date (' 22/10/2014 ',' dd/mm/yyyy'), 1, 0 of all the double union

4 Select 1, to_date (' 23/10/2014 ',' dd/mm/yyyy'), 1, 0 of all the double union

5. Select 1, to_date (' 24/10/2014 ',' dd/mm/yyyy'), 0, 1 Union double all the

6. Select 1, to_date (' 25/10/2014 ',' dd/mm/yyyy'), 1, 0 of the double

7      )

8  --

9. end of test data

10-

11. Select empid

12, prdate

13, unpaid

14, off

15, case when sum (unpaid) over (partition by empid arrested by prdate rows between 3 preceding and preceding 1) = 3

16 then 1

17 other unpaid

18 end as new_unpaid

19, case when sum (unpaid) over (partition by empid arrested by prdate rows between 3 preceding and preceding 1) = 3

20 then 0

21 else off

22 end as new_off

attendance 23

24 * order by empid, prdate

SQL > /.

PRDATE EMPID UNPAID OFF NEW_UNPAID NEW_OFF

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

1 00:00:00 21 OCTOBER 2014 1 0 1 0

1 00:00:00 22 OCTOBER 2014 1 0 1 0

1 00:00:00 OCTOBER 23 2014 1 0 1 0

1 OCTOBER 24, 2014 00:00:00 0 1 1 0

1 00:00:00 25 OCTOBER 2014 1 0 1 0

Keep in mind that this sum an analytical function works on the 'lines', so it's assuming that consecutive days.

If we literally take your condition of "three days before a holiday", then you can modify the analytical windowing clause to use "range" instead of "line"...

Sum (unpaid) over (partition by empid arrested by range between 3 preceding and 1 preceding prdate)

the range clause collaborates with consecutive numbers or dates, so will explain where missing date values in the data and treat those as zero.

Tags: Database

Similar Questions

  • Drawn with the pencil tool seems to fade in and out

    My Nme is Allen Togwell.Case No.: 0183721415. Your type of chat line says I need a graphics card to solve my problem for my CS6. He gave a link but disconnected before I could use it. Can you help me with what type of graphics card, I need. I am 75 years old and not very literate com.

    Thank you

    Hi Allen,.

    I looked at the file number and watched a recording of you work with the agent and I am not convinced that what you see is necessarily due to the graphics card.

    This is my interpretation and thoughts around what have seen you. I noticed that you are working on an image that took a good amount of the screen seen in the zoom of 16.7%. In other words, that it was a large enough image. Then I noticed that you use the pencil tool with a piece that was 4 pixels.

    I think that the combination of these two things was the reason for which the pencil tool appeared jerky or fade in and out when establishing. This happens because you are using such a small size and are zooming back as long as the lines are barely visible. When you zoom in her resamples program appearance. This resampling can cause detail to be lost and the appearance of vary depending on what level of zoom is used, 16.7% is particularly bad, with fine detail.

    I think that there are two solutions, use a different zoom level to get a better view or use a pencil with a larger size.

    I recorded this video for you for example

    http://screencast.com/t/e9dhiHKoKbv

    I suspect the list that the agent was suggested for video cards was at the bottom of this document

    http://helpx.Adobe.com/Photoshop/KB/Photoshop-CS6-GPU-FAQ.html

    Hope that helps,

    -Dave

  • Where the of can see the in and out point time?

    I'm combining a lot of extracts from different movies into one and because sound levels are different in each clip, I extracted the audio clips, mp3gain applied to them and them inserted in the calendar below the corresponding video clip. Of course, I would first of all the points of entry and these audio clips on the same values as the video, but I don't know an easy way to see the in and out point time.

    If I double click on the video (i.e. open it int the preview window) I can scrub the timeline and see where the point is in, but is not very accurate, and I wish that were true.

    As well, any of this just ask: how to find exactly in/point of a clip in the timeline to exit?

    For what you are wanting to do, I highly recommend using Audio Mixer. This is great to do exactly what you want and will be 'automate' changes via track keyframes.

    I do this as on the process of the latest in my editing, because I want to make sure I have all my game cuts. In fact, any Audio work is at the end of my workflow. Once my changes are visually where and how I want them, I launch Audio Mixer. If I have several tracks Audio, such as Narration and soundtrack, I cut these and start "riding gain", or "soil" that I play the movie and listen very carefully with good headphones. As the movie plays, I adjust the Gain to exactly what I want for this entire Audio track. Because PE sets keyframes on the Audio track, you can go back and basically re-save your changes in a particular area. It is much simpler in PE, as Audio Mixer of PrPro, while the latter allows more "power". When I finished my Track dialogue, I leave on as reference and then reactivate my storytelling, adapting it properly. Finally, I will leave these two and address the same way soundtrack. Once this is done, you can then play with the Audio Mixer Panel open all and look at the 'pot' for Gain moves automatically in each Audio track.

    The main reason for doing this the last stage of the workflow of editing is because key frames are on the Audio track (s) and NOT on Clips. If you go to edit the Clips, changing their duration, etc., you need to delete your key frames of the track and start over, or adjustments will be more correct.

    It's basically how it's done in Hollywood.

    Good luck and don't forget a good pair of headphones to really listen carefully. I do not work with a large number of meter settings, other than look for cutting, but rather listen to the piece and my changes.

    Hunt

  • YouTube the sound cuts in and out

    In recent days, the videos YouTube is, at times, distorted, cuts in and out. This phenomenon appears only show all listening with, wireless, headset. When I disconnect the headphones and listen through the speakers of the iMac, the sound is normal. Also, AFAIK, the phenomenon isn't that videos of YouTube in Safari or Firefox, not iTunes internet radio, videos played in media players etc.

    I listen to the videos on a background of radio internet iTunes, and when the problems of its manifest, the sound of internet radio iTunes is smothered. Returns to the top of the normal when the distortion stops, and when I stop the video playback.

    I tried uninstalling and reinstalling adobe flashplayer (latest version), I deleted the browsing history, cache and cookies. Did not help.

    El Capitan, Firefox, Safari, latest versions.

    Someone has any idea how to solve this problem?

    I think that I thought about it.

    But first, I have to clarify that not all YouTube videos deal with this problem of sound. Only certain channels, no problems with other channels, except where they included third-party clips in their videos.

    I read somewhere that the headset and the computer must be plugged into the same power strip. I checked that. They were (Belkin Surge Master). So I tried to plug in the headphones to a different power strip (regular, plugged in the Belkin Surge Master), and of course, the problems of sound disappeared as if by magic. If anyone has an explanation for that, I'll be glad to hear.

  • Video uploaded to Vimeo "rebounds" in and out!

    I downloaded some videos from Vimeo recently and I can only describe as "alternating" images in and out  .  .  See the example below:-

    https://youtu.be/mA5J5k9NvY4

    It was a 4K video playing perfectly while on Vimeo, but downloading, looks like this, which is a screenshot of the downloaded video playing on my desk.  .  .  I also converted it 720 p to make it easier to download.

    Is this something 'bounce' Vimeo has put in place to prevent people to download or is there another reason?

    I should also add that my computer plays perfectly the other 4K videos.

    What file format is the downloaded file from Vimeo?

  • Wireless seems to drop in and out sporadically

    Wireless seems to drop in and out sporadically.  Time capsule is wired on the desktop; However, all other devices in the House keep dropping the Wi - Fi and are always asking for network password even if it is already registered in each device.  Three iPads, two iPhones, printer, laptop, etc... Very frustrating to spend the money on time capsule upgrade and have this happen.  Everything was very well on old AirPort Extreme.  What I've done wrong?

    Things are usually OK if you turn off the AirPort Extreme, which is used to "extend" the network... and... estart the time Capsule?

    If Yes, then configure AirPort Extreme correctly... see your other post... might solve your problem.

  • Zoom in and out of the Web site Windows no dependencies a mouse - windows 7 pc

    I do not use a mouse on my laptop. Each time the window zoom in or out because that weighs a finger on the touchpad. How do I Zoom in and out in order to control the size of the window?

    Hello JRStef, you can reset the level of zoom of a page by pressing CTRL + 0 ("zero"). CTRL + -/ + decreases / increases the zoom.

  • Audio fades in and out on m9400t

    The noise began fading in and out while watching television on my Media Center m9400t.  Has anyone seen cela or have any ideas on a fix?  I use the audio material deault Realtek, no optional sound card.

    Message edited by Big_Al12 on 04/13/2009 06:22
    Message edited by Big_Al12 on 04/13/2009 06:22
    Message edited by Big_Al12 on 04/13/2009 06:22

    I think I solved my problem.  I opened Control Panel Realtek no sound control panel and set by default and on Virtual Surround speakers.  I watched two recorded HD shows and several hours of programming with any his erasure of HD air.  This may very well be the solution!

  • I can't 'click' on the top inch of any screen in the case of firefox. It won't let me sign in and out of some Web pages. This happens not when I'm on my desk or using IE. I like firefox, but it's frustrating. Help!

    I can't 'click' on the top inch of any screen in the case of firefox. It won't let me sign in and out of some Web pages. If I reduce the screen that disappears not or the other. This happens not when I'm on my desk or using IE. I like firefox, but it's frustrating! Help!

    Try Firefox SafeMode to see how it works there.

    A way of solving problems, which disables most of the modules.

    (If you use it, switch to the default theme).

    • You can open the Firefox 4, 5, 6, 7 SafeMode pressing the SHIFT key when you use the desktop Firefox or shortcut in the start menu.
    • Or use the Help menu option, click restart with the disabled... modules while Firefox is running.

    Do not choose anything at the moment, just use 'continue in safe mode.

    To exit safe mode of Firefox, simply close Firefox and wait a few seconds before using the shortcut of Firefox (without the Shift key) to open it again.

    If it's good in Firefox SafeMode, your problem is probably caused by an extension, and you need to understand that one.

    http://support.Mozilla.com/en-us/KB/troubleshooting+extensions+and+themes

  • Thunderbolt and MagSafe 2 combined for non-Apple monitor cable?

    I use my Macbook Pro with a monitor of LG 34UC97 with connection Thunderbolt. Is it possible to get a Thunderbolt cable and MagSafe 2 combined as that provided with the Thunderbolt Apple monitor, and, if so, it will work with the LG monitor? My goal is to use the wire, rather than two, to the Macbook and the connection of the screen.

    I don't believe it.  The built-in Apple cable is their unique design.

  • Satellite A505-S6995 - Audio MP3s fading in and out of play

    Hello

    I had audio problems with this laptop since I bought it, first with the Crackle of the sounds, then I did the update of the bios that seemed to help, but now there are all sorts of problems with his awkward with Windows Media Player. If I use VLC or Winamp to play any of the mp3s on my laptop, there is no audio problem. However, if I use windows media 12 (last updated edition) Player, the audio volume seems to fade in and out and its a little wobbly and certainly enough for you drive crazy. This is strange, because if you go directly to the music folder and click on the mp3 even, it seems, there is a sort of plugin to make an audio preview and it seems to use windows media player (it does not open, but they way the icon looks like just seems to indicate that he) no audio no issues at all. I tried different mp3s with the same question. It is not hard I crank my system. It also happens with headphones and speakers. There is no audio problem with netflix audio, streaming, on demand, etc. I will continue to look and see if I forget something, but I have yet to find solutions.

    Here are my specs:
    TOSHIBA Satellite A505-S6995 laptop Intel Core 2 Duo P7450(2.13GHz) 16 "6 GB memory DDR3 1066 500 GB HD 5400 RPM DVD Super Multi NVIDIA GeForce GT 230 M?" / Windows 7 Home Premium 64-bit Service pack 1
    Version 1.80 - 03Updated-06-2010 nVIDIA VBIOS N10P/n10M to fix an audio crackling problem. ?

    Any help would be greatly appreciated!
    Thank you

    Looks like the audio be normalized.

    Disable the standardization in Media Player.
    You can also disable the improvements in the sound control panel.

  • Skype constantly signing in and out

    Skype will keep signing me in and out randomly, when I try to reconnect immediately, it takes me to the connection and I must repeat 5 times before I get into Skype and when I'm in there all my contacts are offline, and when this happens, calls ive been in continued when he signs allowing me to create multiple instances of the call signed at must still take more than 5 minutes. something like this using Skype for years and never met before, all and any help is much apreciated

    Open your Skype account setup page:

    https://secure.Skype.com/portal/account/settings

    If your Skype account is associated with the account of Microsoft, then try to separate them.

    https://support.Skype.com/en/FAQ/FA12211/how-do-i-unlink-my-Skype-and-Microsoft-or-Facebook-accounts

  • Tecra M2 errors with screen: colors black, white & Rainbow fade in and out

    My laptop screen fades in and out with the colors white, black, grey and Rainbow. No command/function is able to accomplish. When I disable (using the power button) and back on, it goes back to wipe the screen. My laptop is currently useless. Someone had this problem? Any help for a novice? Thank you

    Hello

    The best thing you can do is to test it with the external monitor. If the external monitor shows your desktop well probably the LCD is faulty. By the same result on the external monitor, the problem may be caused by a faulty graphics card.

    That's all that I can say about it.

  • How can I improve my reception of bluetooth from my MacBook pro? Permanent cuts in and out.

    Bluetooth keeps cutting in and out

    You will need to provide more information (distance, other factors).

    Barry

  • Zoom in and out on a picture when I only have a touch screen?

    Hi all

    I'll put up a request for inspection, taking a touch screen. However the user want to zoom in and out on images. Zoom is OK - just grab the magnifying glass lens and click - but I don't see how to zoom with no shift key.

    Anyone got any suggestions?

    Maybe keep a logical button/contol and connect it to enlarge the property indicator of the image factor.

    -When the operator presses the button/control, you can change the zoom level

Maybe you are looking for