Number of a specific day within a specific period

Hi all,
I want to form a query something like - "select count(saturdays) between '01/01/2007' and '31/12/2007' "
And the output should be like this -
Count
53
not sure, if 53 is correct or not.
And one more query which returns like this -
Saturday falls on
06/01/2007
13/01/2007
20/01/2007
27/01/2007
03/02/2007
10/02/2007
17/02/2007
29/12/2007
Is this possible without having data in any other table. I mean, can we frame a query just from dual and get these results.
Your assistance please...

Are you looking for something like this?
SQL> WITH t
  2  AS
  3  (
  4  SELECT TO_DATE('01/01/2007','DD/MM/YYYY') start_dt, TO_DATE('31/12/2007','DD/MM/YYYY') end_dt FROM DUAL
  5  )
  6  SELECT SUM(DECODE(TRIM(TO_CHAR(dt,'DY')),'SAT',1,0))
  7  FROM
  8  (   SELECT start_dt+LEVEL-1 dt
  9      FROM t
10      CONNECT BY LEVEL < (end_dt-start_dt)+2
11  )
12  /
SUM(DECODE(TRIM(TO_CHAR(DT,'DY')),'SAT',1,0))
                                           52

Similar Messages

  • Sales Analysis Tcode MCTE - drilldown per day within a period?

    Hello,
    Current settings in transaction MCTE allow a user to find the total sales figures per organization for the given period.
    Within that period, is there a way to drilldown in order to see the total sales per day within the given period?  If it's not possible in the MCTE transaction, is there another standard transaction that can be accessed to find this information?  Any help would be greatly appreciated.

    Andy
    There is no way to drill down with a period to days after you chose Period,  say Month.
    But there is a workaround to this.
    Make the 'day' as the period unit, in other words, update on a daily basis. T code omo1
    Hope this helps.

  • Logic to calculate average number of employees per day...

    Hi,
    In an internal table, i have employee number, start date, end date.
    This table shows employee's start and end dates for a cost center.
    Now, the requirement is to calculate the average number of employees available per day for a given period...
    Lets asume that we would like to calculate average number of employees per day for a given period of 30 days (01.01..2009 to 30.01.2009)....
    The above table will have around 20 employees with their start and end date.
    Among these 20, some may be present between 1st to 10th Jan only..
    In such case, How to calculate average number of employees per day in such case?
    Can anyone help me out with a rough sketch of logic for this calculation?
    Thanks in Advance,
    Pavan

    My Logic:
    1) First choose dates from which date to which date you are planning to calculate. [Here i am trying to calculate from Jan 1st 2008 to till date - March 3rd 2009 = So total days = 427 days]
    2) First try to count number of days worked in organization by each employee. [Lets take employee a = 10 days, b = 182 days, c = 427 days].
    3) Then total all the number of days. [abc = 10182427 = 619 days].
    4) Total number days / Total number of days worked = 619 / 427 =  1.44 employees per day.
    Employee     Emp-Start Date     Emp-End Date     No. of days
    a             Jan 1st 2008     Jan 10th 2008     10
    b             Jun 1st 2008     Jun 30th 2008     182
    c            Jan 1st  2008     3rd March 2009     427
              Total No. of days                     619
         From Jan1st 2008 to Till date 3rd March 09          427
              619 / 427 =     1.449648712
    I tried take simple example to recheck the above scenario is correct or not. If 'n' number of employees worked for an organization in a year (365 days) is 730. then per day = 730 / 365 = 2 employees per day worked for organization.
    I am not sure my logic is correct or not ... just tried like above.
    Regards,
    ~Satya

  • Inactive Item report to show Item bought within a specific period and not sold within a specific period by whse and have stock

    Hi
    I'm trying to come up with query report to show Inactive Item bought within a specific period and not sold within a specific period by whse and have stock
    The report should show  Item Number, Item Name ,Item cost,Retail Price [Based on a price list], Qty in Whse, Last Purchase Date, Last sale Date etc.
    e.g item bought between 2011-2013 and have not been sold with the same date range or the last 12 months.
    Regards
    Brian Ndunda.

    Hi,
    Try this query:
    SELECT T0.[ItemCode], T0.[ItemName], T0.[OnHand], T0.[AvgPrice], T0.[LastPurPrc], T0.[LstSalDate] FROM OITM T0  left JOIN INV1 T1 ON T0.ItemCode = T1.ItemCode left JOIN OINV T2 ON T1.DocEntry = T2.DocEntry WHERE T1.[Quantity] is null and  T0.[OnHand] >0 GROUP BY T0.[ItemCode], T0.[ItemName], T0.[OnHand], T0.[AvgPrice], T0.[LastPurPrc], T0.[LstSalDate]
    Thanks & Regards,
    Nagarajan

  • Create a Crystal report to display the sum of G/L account code within a specific period

    Hi,
    Just wonder is it possible to create a crystal report to display the total of a G/L account code within a specific period?
    How to write the query to get the sum within a specific period?
    For example:
    Period: 2014-06-01-2014-06-10
    Account code A: USD "TOTAL"
    Account code B: USD "TOTAL"
    Thanks

    Hi Olga,
    Please check below Query.
    SELECT T1.[Account], T1.[ShortName], SUM (T1.[Debit]) as Debit, SUM (T1.[Credit]) As Credit, SUM (T1.[FCDebit]) As FCDebit, SUM (T1.[FCCredit]) As FCCredit, SUM (T1.[SYSDeb]) As SysDebit , SUM (T1.[SYSCred]) As SysCredit  FROM OJDT T0  INNER JOIN JDT1 T1 ON T0.[TransId] = T1.[TransId] WHERE T1.[RefDate] >=[%3]  AND   T1.[RefDate] <=[%4]
    Hope this Help
    Regards::::
    Atul Chakraborty

  • How to get 2 Dates of a specific day From a Pay period

    Hi
    I have a date range (Pay period). now from the start date i Need to find out both Dates of a specific day of that Pay period.
    For Example If i know the date range is
    01/06/2007 to  01/19/2007
    Then I need to know what are the dates for both Saturdays.
    Here it should be 01.06.2007 and 01.13.2007.
    Please help. I always award points. Thanks
    Message was edited by:
            Anwarul Kabir

    Hi,
    Please try this.
    PARAMETERS: P_START LIKE SY-DATUM,
                P_END   LIKE SY-DATUM.
    DATA: DAYS    TYPE I,
          WEEKDAY LIKE DTRESR-WEEKDAY.
    DAYS = P_END - P_START.
    DO DAYS TIMES.
      CALL FUNCTION 'DATE_TO_DAY'
        EXPORTING
          DATE    = P_START
        IMPORTING
          WEEKDAY = WEEKDAY.
      IF WEEKDAY = 'Sat.'.
        WRITE: / P_START.
      ENDIF.
      P_START = P_START + 1.
    ENDDO.
    Regards,
    Ferry Lianto

  • [JS CS3] Check the pattern of a random number given a specific data ?

    Hi all,
    I succeed getting a random number of this look : d.dd (8.73 for ex)
    I use Math.random()*(max-min)+min;
    I want to check that this number respect a specific given increment.
    To be clear :
    If I set min to 0 and max to 10 for example.
    The script returns a number like 8.56
    Now, I have a increment like 0.2
    I want the script to give me a number that can be d,d.2,d.4,d.6,d.8
    BUT NOT d.78 or d.1
    I guess I may use a while command but have no idea of the checking operation.
    Any idea ?
    Thanks in advance.
    Loic

    Math to the rescue. You want a random integer div 5.
    Math.floor(5*(Math.random()*(max-min)+min))/5 should do it.

  • Does serial number come with specific motherboard or it's replaceable?

    Hello guys, there have been a lot of sudden death issues of Z3C and I was one of the victims too, luckily just got it back after nearly 2 months wait
    Anyway I was told that they had replaced a new motherboard to fix the problem, but I don't really think so because when I went to the repair centre they gave me a paper with a parts list they repaired and replaced, which included screen, lock button and so on but no "motherboard" or "mainboard" written on it, I looked again and again just to make sure. If they did change the motherboard, would there be a new serial number because when I checked it in the Android setting it is still the same as the first time I bought it, is this true or they can insert the same serial number into the new motherboard? I know this may sound crazy or dumb, I will be happy if they didn't because there's still a chance for me to retrieve all the previous datas which meant so much to me. Thanks for the help guys!

    Thanks for your reply Thommo, I had already contacted Xperia care there was nothing they could do to retrieve the data, but I have just found Wondershare Dr.Fone and some other data recovery softwares that can help to retrieve the lost data for non-rooted phones. However I don't know why only Z3C needs to be rooted in order to perform data retrieval but as stated in other websites rooting Z3C will void the DRM that result in bad quality low-light photos... So if possible I will unroot it but it seems like there hasn't been a way released yet to unroot Z3C so far, right? So I'm like stuck in between
    So before I root I just want to confirm if the IMEI / serial number comes with specific motherboard, if yes then there's still hope left to get back everything I want because that means they didn't replace the motherboard at all!

  • Oracle HR 11.5.7 -Select DateTracked Info of Employees for Specific Period

    Oracle HR 11.5.7 -Select DateTracked Info of Employees for Specific Period (From/To)
    Hi,
    We have Oracle Human Resources 11.5.7 and I would like to know which is the best way to use when need to query data for employees valid within a specific period (From/To) or at specific date.
    For example:
    Say Current Date= 25-OCT-05
    1.
    If I want to query the number of employees booked for a training event occurred as at 01-AUG-05 and one of the employees booked left as at 30-SEP-05, I would like to be included in the query.
    or 2.
    If I want to see the employees assignment details for a specific period to see the active(latest) assignment details as at that period.
    I would appreciate any feedback regarding the best way to do such queries as far as accuracy of data and performance is concerned.
    Thanking you in advance.
    Best regards,
    Elena

    Thank you for your reply..:)
    Actually I'm already using this..
    My problem is when I need to retrieve information for a specific period of time.
    For example say I want to retrieve all sickness absences for Year 2004 and want to retrieve the last employee details (people & assignment tables) that fall within this period (either with an effective date >= sysdate (ie. still active) or which was current upto 31-dec-2004 and might changed later on).
    To be more specific let's say an employee took sick leave in 2004 for total 10 days and has the following rows in per_people_f and per_assignments_f:
    per_people_f:
    start_date end_date person_id other personal details
    01-FEB-2001 - 15-MAR-2004 3808 xxxx
    16-MAR-2004 - 30-JUN-2004 3808 yyyy
    01-JUL-2004 - 17-FEB-2005 3808 zzzz
    18-FEB-2005 TO DATE 3808 www
    per_assignments_f:
    start_date end_date person_id assign_id other assignment details
    01-FEB-2001 - 15-JAN-2003 3808 1114 aaaa
    16-JAN-2003 - 30-AUG-2004 3808 1114 bbbb
    31-AUG-2004 - TO DATE 3808 1114 cccc
    What I need the query to return for the above example is:
    per_people_f:
    start_date end_date person_id other personal details
    01-JUL-2004 - 17-FEB-2005 3808 zzzz
    and
    per_assignments_f:
    start_date end_date person_id assign_id other assignment details
    31-AUG-2004 - TO DATE 3808 1114 cccc
    and sickness days =10
    (sum of duration where
    absence start_date >= 01-JAN-2004
    AND end_date<=31-DEC-2004)
    Thanking you in advance for any help on this issue.
    Regards,
    Elena

  • Export data for specific period through Data Pump

    Hi,
    I've a specific requirement to take the dumps of some tables for specific time period. like between last 10 days like 01-JAN-11 to 10-JAN-11. How can I acommplish this. For Documentation what I read is that we can export the data for specific period of thie by either setting FLASHBACK_SCN or FLASHBACK_TIME parameter in expdp command but this is point in time export not for the specific time export.
    Please guide me how can export between the specific time. like between 1-JAN to 10-JAN
    Regards,
    Abbasi

    export between the specific time. like between 1-JAN to 10-JANYou need to clarify your requirements. Data is always "at a point in time". I can see data as at noon of 01-Jan. I can see data as at noon of 10-Jan. What would I mean by data "between" 01-Jan and 10-Jan ?
    Say the table has 5 rows on 01-Jan :
    ID    VALUES
    1      ABC
    2      DEF
    3      TRG
    4      MXY
    5     DEW2 Rows "6-GGG" and "7-FRD" were inserted on 02-Jan.
    2 Rows "2" and "3" were updated from "DEF" and "TRG" to "RTU" and "GTR" on 03-Jan.
    1 Row "5-DEW" was deleted on 09-Jan.
    2 Rows "8-TFE" and "9-DZN" were insereted on 09-Jan.
    Can you tell me what is the "data between 01-Jan and 10-Jan" ?
    (the above example actually happens to have an incrementing key column "ID". Your table might not even have such an identifier column at all !)
    Hemant K Chitale
    Edited by: Hemant K Chitale on Jan 10, 2011 5:23 PM

  • TS3988 synchronizing in specific period

    My email is not synchronizing in a specific period from May 2012 till day before yesterday. From yesterday the new email and mail before May 2012 is synchronizing well. I have tried to delete my icloud account and than loaded again. Same problem is occured. On the icloud server my latest emails are still there.
    Who can advice or help me, Simon

    Hi karthik..
    here you are.
    SELECT   br.resources, rmst.resource_desc, b.cost_cmpntcls_code,
    *(AVG (gmf_cmcommon.get_rsrc_cost (br.resources,*
    bh.organization_id,
    bvd.consume_layer_date,
    *1000,*
    *0*
    *) avg_resource_cost,*
    SUM (bvd.consume_ib_pri_qty) hrs,
    *( (SUM (bvd.consume_ib_pri_qty))*
    ** (AVG (gmf_cmcommon.get_rsrc_cost (br.resources,*
    bh.organization_id,
    bvd.consume_layer_date,
    *1000,*
    *0*
    *) AS rsc_value*
    FROM gmf_batch_vib_details bvd,
    gmf_batch_requirements br,
    gme_batch_header_vw bh,
    cr_rsrc_mst_vl rmst,
    cm_cmpt_mst_b b
    WHERE rmst.cost_cmpntcls_id = b.cost_cmpntcls_id
    AND bh.organization_id = :p_org_id
    AND br.resources BETWEEN NVL (:p_resources_lo, br.resources)
    AND NVL (:p_resources_hi, br.resources)
    AND br.batch_id = bh.batch_id
    AND br.resources IS NOT NULL
    AND br.ingredient_item_id IS NULL
    AND bvd.requirement_id = br.requirement_id
    AND bvd.line_type = 0
    AND rmst.resources = br.resources
    AND b.cost_cmpntcls_code BETWEEN NVL (:p_cmpntcls_lo,
    b.cost_cmpntcls_code
    AND NVL (:p_cmpntcls_hi,
    b.cost_cmpntcls_code
    AND (   rmst.resource_class >=
    NVL (:p_resource_class_low, rmst.resource_class)
    OR (rmst.resource_class IS NULL AND :p_resource_class_low IS NULL)
    AND (   rmst.resource_class <=
    NVL (:p_resource_class_hi, rmst.resource_class)
    OR (rmst.resource_class IS NULL AND :p_resource_class_hi IS NULL)
    GROUP BY b.cost_cmpntcls_code, br.resources, rmst.resource_desc
    waiting for your suggestions .
    Edited by: Ahmed.Abbas on Jul 12, 2011 6:30 AM

  • How to get total number of days in current Fiscal period/year

    Hi,
    I need to get total number of days in current Fiscal period/year (current month) and assign it to an infoobject. I need a routine for this. Is there any function module to get this.If possible pls paste the ABAP code also for this task. Thanks in advance

    here is the FM:
    LAST_DAY_IN_PERIOD_GET
    KJ!!!

  • WCS Lobby Ambassador audit report for a specific period of time

    Hi all,
    I know there is an WCS audit report for each lobby ambassador activities. But the problem is that I see only activities from Nov 9 to the present. I don't know what the reason is, whether somebody erased that information before Nov 9 or something else happened.
    Is there any option to manually configure a specific period of time, for example obtain all activities for last 3 months?
    Thanks for any hint.
    Jozef

    Hi Koti,
    What error did you meet when you used audit report from Oct 16 to Oct 31?
    Please check the log file to find more information about this issue. The path of the log file is: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\LOGS. You can check the log file whose modified date is from Oct 16 to Oct 31.
    In addition, please deactivate and reactivate Reporting feature at site collection level.
    A similar post for your reference:
    http://sharepointknowledgebase.blogspot.com/2012/07/unexpected-error-when-trying-to-view.html#.VG2cFouUeog
    About audit log report, please take a look at:
    https://support.office.com/en-us/article/Configure-audit-settings-for-a-site-collection-a9920c97-38c0-44f2-8bcb-4cf1e2ae22d2?ui=en-US&rs=en-US&ad=US
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • New GL - Financial Statement for Specific Periods

    We are using the new GL. I am looking for a report similar to F.01. Instead of displaying reporting period, comparison period, absolute difference, and rel diff, we would like to display amounts for specific periods.
    For example, we would like to see totals for period 11 2009, period 10 2010, and period 11 2010 all in one report with columns like below.
    Ccode     Acct          11.2009          10.2010          11.2010
    ABCD     101000          7.221,53     6.482,51     5.418,92
    ABCD     102000          2.447,34     2.361,81     3.144,62
    Is there such a report? I have looked, but it appears that all the reports can only be displayed for a range of periods.
    Thanks for your help.
    Brenda

    Hi,
    define such a report using T-code FGI0.
    Best regards, Christian

  • Determine the number of days in a False period in a Temporal Boolean

    Hi all,
    I need to determiine the number of days based on a condition that lies on the gaps between the periods.
    My input consists of multiple periods. The length of the gap is the condition to determine the start date for summation. However, there can be multimple gaps between my instances that satisfy this condition and I need the last one that satisfies it.
    For example:
    period 1: 1-1-1990 until 31-12-1992
    period 2: 1-1-1994 until 31-12-1996
    period 3: 1-1-1998 until 31-12-1999
    period 4: 1-6-2000 until 31-12-2009
    The condition for the start date is the last gap greater than 1 year. In this example, the start date should be the start date of period 3: 1-1-1998, because this is the period after the last gap >= 1 year. Period 2 also has a previous gap of >= 1 year, but this period should NOT be selected.
    My first idea was to use a TBR function: to determine relevant periods (based on the gaps before and after), calculate the amount of days per relevant period and add those up. However, if I want to do that I need to calculate the number of days in the gaps and I don't see how to do that, since I cannot determine a day difference across periods (end date period 1 until start date period 2).
    Any help/ other solution ideas?
    Kind regards, Els

    This was an interesting puzzle which you can solve from a couple of different angles.
    Firstly, you can use inferred relationships to infer a relationship "the following periods" (ie. the periods that follow the current one). My rules looked like this:
    the period (the other period) is a member of the following periods if
       the other period start date > the period start date
    the period’s next start date = InstanceMinimum(the following periods, the period start date)From here it should be easy to see if there was a gap of more than a year, and find the most recent period after a year-long gap. Of course you need to deal with the situation of the last period, when there is no 'next' period, presumably you would use the date of assessment in that case, but I'll leave that as an exercise for the reader.
    A completely different way of doing it is to use the TemporalConsecutiveDays function to find a date where a gap of 365 days exists, then select periods in which there is a gap immediately before the start of that period. Here are some rules that :
    there is a period that applies if
       ExistsScope(the periods)
          TemporalOnOrAfter(the period start date) and
          TemporalOnOrBefore(the period end date)
    there is a year-long gap if
       TemporalConsecutiveDays(365, 365, there is not a period that applies)
    the period starts after a year-long gap if
       ValueAt(the period start date, there is a year-long gap)
    the start date for calculation = InstanceMaximumIf(the periods, the period start date, the period starts after a year-long gap)Hopefully one of these is suitable for your needs.
    cheers,
    Steve.

  • Pull all GL Lines for specific period

    I am in need of pulling all GL Lines for a specific period. However, the query I built is also pulling in Project Account Lines. What I want are lines that posted to an account. I've posted my query below but can someone shed light onto how I can pull al GL Lines that posted to an account for a specific period?
    thanks,
    select distinct
    cb.segment1
    ,cb.segment2
    ,cb.segment3
    ,cb.segment4
    ,cb.segment5
    ,cb.segment6
    ,cb.code_combination_id
    , fv.description acct_desc
    ,jh.posted_date
    ,jh.je_category category
    ,jh.name entry
    ,jh.description reference
    ,jh.external_reference
    ,jb.name batch
    ,jl.accounted_dr debit
    ,jl.accounted_cr credit
    ,usr.user_name last_updated_by_username
    ,usr.description last_updated_by_user
    ,cusr.user_name created_by_username
    ,cusr.description created_by_user
    ,jl.EFFECTIVE_DATE
    ,jl.je_header_id je_unique_id
    from gl_je_headers jh
    , gl_je_lines jl
    , gl_je_batches jb
    , gl_code_combinations cb
    , FND_ID_FLEX_SEGMENTS fs
    , FND_FLEX_VALUES_VL fv
    , fnd_user usr
    , fnd_user cusr
    where
    jh.je_header_id = jl.je_header_id
    and jh.je_batch_id = jb.je_batch_id
    and jl.code_combination_id = cb.code_combination_id
    and fs.flex_value_set_id = fv.flex_value_set_id
    and fv.flex_value = cb.segment1
    and jb.last_updated_by=usr.user_id
    and jb.CREATED_BY = cusr.user_id
    and jl.EFFECTIVE_DATE between '01-APR-10' and '5-APR-10'

    hi friend
    u have specify ur account segments so it will only retrive the account code u want
    u can also limit Source_Name for specifying the source of journals
    but for limiting post date u have to write the posted date u want by putting condition on "Posted_Date" in GL_JE_Headers
    bests

Maybe you are looking for