Specific day of research in a range of data

Hello

I need to create a query that finds all paid employees the 12th of each month, we have about 5 pays different identifiers and the payroll beginning and end date are not the same for some of these IDS of compensation. My query seems to work very well when payroll start and end day fall on the same month, but not when the start date is in a month and the end date is in another month.

Here's some of my where condition:

and '12' between to_char(ptrcaln_start_date,'DD') and to_char (ptrcaln_end_date, 'DD')

Thanks in advance for your help.

Select x.year,
x.pay_id,
x.pay_numb,
Count (x.Employees)
compensation of x,
pay_schedule y
where x.year = y.year
and x.pay_id = y.pay_id
and x.pay_numb = y.pay_numb
and)
trunc (y.pay_start_date, 'MM') + 11 between y.pay_start_date and y.pay_end
or
LAST_DAY (y.pay_start_date) + 12 between y.pay_start_date and y.pay_end
)
X.year group,
x.pay_id,
x.pay_numb
/

SY.

Tags: Database

Similar Questions

  • SQL to count the number of days of January with a range of dates

    I have data like this, how to calculate the number of days with January in this date range.

    BEGINNINGENDDAYS OF JAN
    12/12/201320/01/201420
    21/01/201402/02/201411

    Hello

    So, you want to count the number of days between

    (a) either start_dt, or January 1, 2014 (prevailing later) and

    (b) or end_dt or January 31, 2014 (whichever comes first).

    However, if start_dt and end_dt are prior to January 2014 (or both are later) which will result in a number negative if you take the difference or 0, if it is higher.

    This looks like a job for the GREATER and LESS than functions.

    SELECT start_dt - START is not a column name good

    , end_dt - is neither END

    BIGGER (1 + LESS (end_dt, DATE ' 2014-01-31'))

    -Most GREAT (start_dt, DATE '' 2014-01-01)

    * v

    ) AS jan_days

    FROM table_x

    ;

    If you would care to post CREATE TABLE and INSERT instructions for some examples of data, then I could test it.

  • Specify the Feeder program specific day (recurring)

    You can specify a program Feeder to only run one day recurrent? For example, run every third Wednesday of the month? or 20th day of each month?

    Not necessarily on drivers but there are decision sets the options which can look to see if a particular day of the month.

    So, you could have the charger works always daily / hourly, but in the program, use a decision rule to maintain contacts to a specific day of the month.

  • Report with 2 settings of filtering by day and 3 measures for a range of dates

    Hello

    I need to establish a relationship with the following criteria:

    (a) I have 5 settings

    (b) tell of 2 measures of data should be based on a date 01/01/2015

    (c) rest of 3 data measures should be based on a range of dates say 01/01/2015-31/01/2015

    No idea how to achieve this?  If so please help me.

    Thanks in advance

    LonaD

    You cannot filter the reports by using the filter function in the formula in the column?

  • How to filter for a range of dates calendar events in OS10

    In earlier versions of BlackBerry, I used blackberry.find.FilterExpression to filter the events calendar for a specific range of dates.

    However for BlackBerry OS10 I scoured the web to find a way to do it. I found:http://developer.blackberry.com/html5/apis/blackberry.pim.calendar.calendarfindoptions.html

    I also googled a lot of other sites, but I am unable to understand how to use CalendarFindOptions to refine the calendar of events of a specific timetable. For example, the current week or the next 7 days.

    I found this code example...
    Function listEvents (limit) {}
    Calendar var = blackberry.pim.calendar;
      var CalendarFindOptions = calendar. CalendarFindOptions;
      var findOptions = {}
    'Sort': [{}
    "fieldName": CalendarFindOptions.SORT_FIELD_SUMMARY.
    'desc': false
    }],
    'detail': CalendarFindOptions.DETAIL_AGENDA,
    'limit': limit
    };

    But unable to find examples how adequately limited by date?
    I'm guessing that something like this:
    'Start': new Date (' January 1, 2013, 13:00 "): CalendarFindOptions.SORT_FIELD_START.
    'end': new Date (' January 1, 2013, 16:00 "): CalendarFindOptions.SORT_FIELD_STOP.

    But it is an assumption and does not work I can find no example of how do

    Any help would be appreciated

    See the example for pimcalendar on Github:

    https://github.com/BlackBerry/BB10-WebWorks-samples/tree/master/pimcalendar

    You can find the JS to set filters of beginning and end starts here:

    https://github.com/BlackBerry/BB10-WebWorks-samples/BLOB/master/pimcalendar/index.html#L107

  • How to define the range of data to a strict typdef through the control reference

    Hello world

    I'm trying to define the range of data to a strict typdef through the reference of the order, when I do, I get an 'error of property node.

    Is it possible to set the range of the strict typdef.

    Thank you

    Vignesh

    Vignesh1987 wrote:

    I'm trying to define the range of data to a strict typdef through the reference of the order, when I do, I get an 'error of property node.

    Is it possible to set the range of the strict typdef.

    Try to set the original control (type-def) and not its instances... to open the reference of the original type-def command, use 'Open VI reference'.

    Published:

    These properties are not available with STRICT TYPE DEF.

    a. data entry limits: increment property

    b. data entry property of limits: Maximum

    c. property limits: Minimum for the data entry

  • Filter for table data, the range of data obtained and defined 2D

    I produce data of an ultrasonic sensor at 1 K Hz, and there is a lot of data (data points range of 0 to 10). However, in some cases when I know that the data should be about 7 (for example) I get outliers (about 9 and 10). Is it possible to define a filter for data in the defined range.

    I averaged the data to get an average value, and outliers are distorting. In the worst case, my outliers are 30 to 40% of the data generated. I created a filter to sort the data and, taken from the lowest value. I stop the loop when data reaches a value greater then 9. But this seems to take a long time (because the loop checks for each data point and there are 1000s of them).

    Is there a better way to filter data and define a predefined table range to collect?

    I enclose my filter.vi... and a set of samples of my previous data. The ranges of data of 10-8 and would like to have the range 7.5 to 8.5 to consider. The sensor records tension here and the problem can be solved by installing a different type of sensor, but if a filter in LabView can due it, the sensor that we use now is absolute.

    I am in kind of emergency, my design in unfinished because of this problem, if someone can find some time to share some suggestions, I will be grateful.

    Thanks in advance.

    See attachment.  I have incorporated the data you've posted in the vi.  It doesn't seem like any data were less than 8.7 or so, so I modified the scope so it would be a few points on average.  Some games were completely out of reach while the average came back like NaN (not a number) due to a division by zero.

  • At least a record exists in details that cover the range of dates

    Oracle version:

    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production

    Hi gurus

    I'm stuck with a scenario and your employees need help to solve this problem.

    I have the following table:

    Insertion and table creation

    drop table ident;

    create table ident

    (

    agreement_id number (5),

    ident_pk number (5),

    Date of Cov_effective_date,

    Date of Cov_termination_date

    );

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

    Insert ident

    (

    Select 100,1,to_date('2013-01-01','YYYY-MM-DD'), double to_date('2013-01-31','YYYY-MM-DD')

    Union of all the

    Select 200,2,to_date('2013-01-01','YYYY-MM-DD'), double to_date('2013-12-31','YYYY-MM-DD')

    Union of all the

    Select 300,3, to_date ('2013-03-01 ',' YYYY-MM-DD '), double null

    );

    Query on table

    Select * ident;

    Agreement_id ident_pk Cov_effective_date Cov_termination_date

    100113/01/0113/01/31
    200213/01/0113/12/31
    300313/03/01

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

    Drop table ident_dtl;

    create the table ident_dtl

    (

    ident_pk number (5),

    ident_dtl_pk number (5),

    date of effective_date,

    date of termination_date

    );

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

    insert into ident_dtl

    (

    Select 1-ident_pk, 10 ident_dtl_pk, to_date('2013-01-01','YYYY-MM-DD') effective_date, to_date('2013-01-31','YYYY-MM-DD') termination_date of double - to agreement_id = 100

    Union of all the

    Select 1,11,to_date('2013-01-01','YYYY-MM-DD'), to_date('2013-01-30','YYYY-MM-DD') of double - to agreement_id = 100

    Union of all the

    Select 2,12,to_date('2013-01-01','YYYY-MM-DD'), to_date('2013-01-30','YYYY-MM-DD') of double - for agreement_id = 200

    Union of all the

    Select 2.13, to_date('2013-01-01','YYYY-MM-DD'), double to_date('2013-01-15','YYYY-MM-DD') - for agreement_id is 200

    Union of all the

    Select 3.14, to_date('2013-01-01','YYYY-MM-DD'), double to_date('2013-01-15','YYYY-MM-DD') - for agreement_id = 300

    Union of all the

    Select 3.15, to_date('2013-01-01','YYYY-MM-DD'), double to_date('2013-01-15','YYYY-MM-DD') - for agreement_id = 300

    );

    Query on table

    Ident_pk Ident_dtl_pk Effective_date Termination_date

    11013/01/0113/01/31
    11113/01/0113/01/30
    21213/01/0113/01/30
    21313/01/0113/01/15
    31413/01/0113/01/15
    31513/01/0113/01/15


    Result of the will

    Agreement_Id Ident_pk

    200                                        2

    300                                        3

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

    There is a single entry in ident against agreement_id and Ident_pk and if you can see that ident_pk is also present in the child table. My requirement is that at least 1 effective_date and child termination_date table must be match/equal to the parent table that is ident cov_effective_date and cov_termination_date against the same column of Ident_pk.

    for example:

    See the data in Ident_pk = 1, a = cov_effective_date 13/01/01 and its cov_termination_date = 13/01/31 and in the details table against column Ident_pk = 1, you can find that at lease 1 combinaisondes date match against Ident_pk = 1

    If you see Ident_pk = 2, then you can't find all the effective_date and termination_date against its corresponding cov_effective_date and termination_date Ident_pk...

    Same as 3

    -----------

    Summary is that there are date range in the ident against agreement_id and Ident_pk table and at least a range of dates even should be exist in detail table is ident_dtl against Ident_pk and if not then show that agreement_id and Ident_pk .

    I made this task using PL/SQL, but I think that there is a way to do the same task in SQL. Guide and if you have any questions then please let me know. Thank you

    Concerning

    Shu


    Hello

    To be considered as a football game, the same line in ident_dtl must have effective_date and termination_date correspondence?

    If so, a solution is:

    SELECT i.agreement_id

    i.ident_pk

    Ident I have

    LEFT OUTER JOIN ident_dtl d.ident_pk d = i.ident_pk

    AND d.effective_date = i.cov_effective_date

    AND d.termination_date = i.cov_termination_date

    WHERE d.ident_pk IS NULL

    ;

    Another pure SQL approach to such problems is to use an EXISTS subquery.

  • Extend a range of dates

    I have the following query, which works without problem. This will expand the range of dates, proof of identity, in a list of dates for me:
    SELECT     j_id
              ,  date_1
               + LEVEL
               - 1
                 datum
    FROM       (SELECT 123 j_id, TO_DATE('01/01/2012', 'DD/MM/YYYY') date_1, TO_DATE('31/01/2012', 'DD/MM/YYYY') date_2
                FROM   DUAL)
    CONNECT BY LEVEL <= (  date_2
                         - date_1
                         + 1);
    How can I do this for more than 1 sheet well? for example
    SELECT     j_id
              ,  date_1
               + LEVEL
               - 1
                 datum
    FROM       (SELECT 123 j_id, TO_DATE('01/01/2012', 'DD/MM/YYYY') date_1, TO_DATE('31/01/2012', 'DD/MM/YYYY') date_2
                FROM   DUAL
                UNION
                SELECT 456 j_id, TO_DATE('01/02/2012', 'DD/MM/YYYY') date_1, TO_DATE('29/02/2012', 'DD/MM/YYYY') date_2
                FROM   DUAL)
    CONNECT BY LEVEL <= (  date_2
                         - date_1
                         + 1);
    Thank you.

    Hello

    Here's one way:

    WITH   cntr          AS
    (
         SELECT     LEVEL - 1     AS n
         FROM     (
                  SELECT  MAX (date_2 - date_1)     AS max_dif
                  FROM    table_x
              )
         CONNECT BY     LEVEL <= 1 + max_dif
    )
    SELECT       x.j_id
    ,       x.date_1 + c.n
    FROM       table_x  x
    JOIN       cntr        c  ON  c.n <= x.date_2 - x.date_1
    ORDER BY  x.j_id
    ,            c.n
    ;
    

    If you do any filtering, it may be more effective to do this first. Start the WITH clause with a subquery that performs filtering, then use this result placed instead of your full table in the view online within the cntr as well as in the main query.
    For example:

    CREATE TABLE  table_x         AS
             SELECT 123 j_id, TO_DATE('01/01/2012', 'DD/MM/YYYY') date_1, TO_DATE('31/01/2012', 'DD/MM/YYYY') date_2
                FROM   DUAL
                UNION
                SELECT 456 j_id, TO_DATE('01/02/2012', 'DD/MM/YYYY') date_1, TO_DATE('29/02/2012', 'DD/MM/YYYY') date_2
                FROM   DUAL
    UNION         SELECT 999,          TO_DATE ('01/01/2013', 'DD/MM/YYYY'),     TO_DATE ('31/12/2013', 'DD/MM/YYYY')     FROM dual
    ;
    
    WITH     filtered_data     AS
    (
         SELECT     *
         FROM     table_x
         WHERE     date_1     < TO_DATE ('01/07/2012', 'DD/MM/YYYY')
    )
    ,        cntr          AS
    (
         SELECT     LEVEL - 1     AS n
         FROM     (
                  SELECT  MAX (date_2 - date_1)     AS max_dif
                  FROM    filtered_data
              )
         CONNECT BY     LEVEL <= 1 + max_dif
    )
    SELECT       f.j_id
    ,       f.date_1 + c.n
    FROM       filtered_data  f
    JOIN       cntr              c  ON   c.n  <= f.date_2 - f.date_1
    ORDER BY  f.j_id
    ,            c.n
    ;
    

    Published by: Frank Kulash, 27 January 2012 10:10
    Posted filtering example

  • I'm looking for a tutorial I found a few days back on the display of tabular data in Flex

    Hello

    I picked up Flex programming a few days ago and I learned about the data grids and tabular display of data. I came across a tutorial with sample code that shows how 1. display information in a tabular format.

    2. how to read this information in an xml

    3. how to display more information if an element in the form of table are selected.

    the tutorial uses the players and their games favourite elements of tabular data, and once an item is selected, he showed the news editor of the game and detailed text information. I'm looking for this particular tutorial again and not able to find through google search

    Could you please help me find this article once again?

    Kind regards
    RAM

    Found.

    http://www.switchonthecode.com/tutorials/Flex-fun-Advanced-DataGrid-topics

  • by selecting specific days of the week for the date range?

    I have a table with a number of clients for about a year, but I want to only select Wednesday and Thursday of
    every week, since the beginning of the dates. Table is simple and has two columns. Each line is separate from a Date
    There is no duplicate of Date, it is counted for every day of the year.

    column 1: number of clients, count (customer_id)
    column 2: Date

    Need help with the best way to achieve this.

    Not sure if it is even possible to select a date in the name of the day?

    Basically, I want to select every Wednesday and Thursday of each week and compare the counts during the week, the week during
    week for the whole week see if charges go upwards or downwards, to get trends, thank you!

    Hello

    Kodiak_Seattle wrote:
    I have a table with a number of clients for about a year, but I want to only select Wednesday and Thursday of
    every week, since the beginning of the dates. Table is simple and has two columns. Each line is separate from a Date
    There is no duplicate of Date, it is counted for every day of the year.

    column 1: number of clients, count (customer_id)
    column 2: Date

    Need help with the best way to achieve this.

    Not sure if it is even possible to select a date in the name of the day?

    Sorry, we don't know what you want.

    To see if a date given (dt) is a Wednesday or Thursday, you can use:

    WHERE   TO_CHAR ( dt
              , 'DY'
              , 'NLS_DATE_LANGUAGE=ENGLISH'     -- If necessary
              )  IN ('WED', 'THU')
    

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).
    See the FAQ forum {message identifier: = 9360002}

  • Formula to determine if a specific day of the week between two dates?

    I am creating a spreadsheet to track my time PD & holiday. I usually work weekends, and my vacation allowance includes a specific maximum number of Sundays a year. Is there a way to calculate how much Sunday fall between a date range (or any day of the week, by the way)?

    (i.e. If my vacation starts February 1, 2016 and ends March 2, 2016, Sunday how are included?)

    I know that I can calculate how many weeks have passed, using = Quotient (DateDiff (Start_Date, End_Date), 7), but it is possible to include two Sundays in a period of 7 days.

    Hi Eric,.

    Here is one approach.

    C2 = A2 + (7−WEEKDAY(A2,2))

    This concludes the first Sunday following the start date.

    D2 = STRIPDURATION ((B2−C2) ÷7)

    I formatted this column without decimal places to see full weeks of the first numbers Sunday.

    Quinn

  • How to display the use of temporary space using OEM for a query that is run on a specific day

    Where scroll in OEM to get the temp space, total used by a query that is run on a day specific/tiime.

    --> PERFORMANCE--> SQL MONITORING DATABASE--> find your sql performance ()--> click the status-->

    --> METRICS DETAILS click--> you will give details on the temporary use.

    (2) see the report--> you will give more details,

    Thank you

    Concerning

    Krishnan

  • Range query date day 1 to day 1-14 years

    I use:

    Oracle SQL Developer (3.0.04)

    Build hand - 04.34

    Oracle Database 11g

    Enterprise Edition 11.2.0.1.0 - 64 bit Production

    I'll have time to diffitult get this filter works:

    {Code}

    where date_value between: day1 and: day 1-14

    {Code}

    What I am doing wrong?

    I am looking for a single day of entry and have it return a range of 14 days. So if I put "June 25, 2013", it must understand that day and the 14 day return track.

    Hello

    When you say "BETWEEN x AND y", x must be the smallest value.

    You need something like:

    WHERE the date_value BETWEEN day 1 - 14 AND day 1

    This assumes that the date_value and day1 are DATEs.  There is no variable binding DATE.  "If: day 1 is a string, such as June 25, 2013", then use TO_DATE to get a DATE based on this string:

    WHERE the date_value BETWEEN TO_DATE (: day1, "MON-DD-YYYY")-14

    AND TO_DATE (: day1, 'DD-MON-YYYY')

  • Assign months within a range of dates (by almost every day in a given month)

    I have a date beginning and end, the sample data as well

    Select to_date('01-13-12','mm-dd-yy') from_dt,
    to_date('02-23-12','mm-DD-yy') to_dt
    of the double
    Union of all the
    Select to_date('03-15-2012','mm-dd-yy') from_dt,
    to_date('04-16-2012','mm-DD-yy') to_dt
    of the double
    Union of all the
    Select to_date('05-13-2012','mm-dd-yy') from_dt,
    to_date('07-23-2012','mm-DD-yy') to_dt
    of the double

    How can I assign a month by most of the days in a month in this date range? Sometimes the date range can be exactly as many days in a month (as the 15/03/2012 has 16 days and 16/04/2012 16 days). In this case, I want to than the previous month (March).

    So according to the data of the sample:

    13/01/2012, 23/02/2012, February
    15/03/2012, 16/04/2012, March
    13/05/2012, 23/07/2012, June

    Thank you

    Published by: user4422426 on March 1, 2012 17:15

    Hello

    Here's one way:

    WITH     cntr          AS
    (
         SELECT     LEVEL - 1     AS n
         FROM     (
                   SELECT      1 + MAX (to_dt - from_dt)     AS max_day_cnt
                   FROM     table_x
              )
         CONNECT BY     LEVEL     <= max_day_cnt
    )
    ,     got_r_num     AS
    (
         SELECT     x.from_dt, x.to_dt
         ,     TRUNC (x.from_dt + c.n, 'MONTH')     AS month
         ,     count (*)                    AS cnt
         ,     ROW_NUMBER () OVER ( PARTITION BY  from_dt, to_dt
                             ORDER BY        COUNT (*)     DESC
                             ,             TRUNC (x.from_dt + c.n, 'MONTH')
                           )     AS r_num
         FROM       cntr     c
         JOIN       table_x  x  ON  c.n  <= x.to_dt - x.from_dt
         GROUP BY  x.from_dt, x.to_dt
         ,       TRUNC (x.from_dt + c.n, 'MONTH')
    )
    SELECT     from_dt, to_dt
    ,     TO_CHAR (month, 'Mon YYYY')     AS mon
    ,     cnt
    FROM     got_r_num
    WHERE     r_num     = 1
    ;
    

    Thanks for posting the code to create the same data. Test your code before you post: you've got the reverse order of the arguments to TO_DATE.

Maybe you are looking for