Check condition for last week

Hi,
I have a table in which records are stored according to datewise. I want to filter records for last week as per sysdate. For ex, today is thursday and i want to see records which had come in between Monday to Sunday last week.
Please help me out here.
Himanshu

Hi,
Here is the query to get first day of last week , last day of last week
SQL>SELECT TO_CHAR((sysdate - to_char(sysdate,'D')),'DAY') LAST_DAY_OF_LW ,
       TO_CHAR((sysdate - to_char(sysdate,'D')) - 6,'DAY') FISRT_DAY_OF_LW,
  2    3         TO_CHAR(sysdate,'DAY') TOday
  4  from dual
  5  /
LAST_DAY_ FISRT_DAY TODAY
SATURDAY  SUNDAY    THURSDAY
1 row selected.Note: Sunday = 1 and Saturday = 7
Regards

Similar Messages

  • Parameter for Last Week, Last Month & Last Year from the current Date

    I have a crystal report that has a StartDate & EndDate parameters from the stored procedure that I am calling. Now i got a new requirement saying that my user wants a drop-down parameter in which they need to be able to select last week (Sunday to Saturday), last month, last year instead of manually selecting start date and end date parameters? Can anyone please explain me how to do this?
    (FYI, I am using Crystal 2008)

    Hi Naveen,
    You'll need to handle the logic in the Stored Proc's where clause.
    If you're using oracle, I have something like this in the Stored Proc's where clause for our reports:
    Where {Date_Field} Between
    Decode('{?Relative Date}',
    'Yesterday', sysdate - 1,
    'Last Week', Tunc(sysdate, 'IW')-7)
    AND
    Decode('{?Relative Date}',
    'Yesterday', sysdate,
    'Last Week', Tunc(sysdate, 'IW'))
    where 'Relative Date' is a prompt in the Stored Proc and 'yesterday'. 'last week' are the 'static values' in the prompt.
    -Abhilash

  • Connected Ips or host name for last week

    Hi
    How can we find the IPs connected to apps for last 1 week,Whether error_log or access_log will give any picture
    rgds
    shrey

    On a regular basis I use the access_logs to see which ips access the ebusiness suite. Haven't really used the error_logs much unless I'm trying to debug a problem.

  • Disconnected ever few minutes for last week

    My dsl has been unusable for the last week.  every few minutes I am disconnected.  Sometimes it reconnects, other time I have to unplug the router and modem to reset.  I have had Verzon dsl for several years with mixed results but this is insane.  I may have reached the breaking point, Comcast may be my next cal...

    Since you have your own router, you may want to follow the info at http://www.dslreports.com/faq/13600
    If you are the original poster (OP) and your issue is solved, please remember to click the "Solution?" button so that others can more easily find it. If anyone has been helpful to you, please show your appreciation by clicking the "Kudos" button.

  • Logged users for last week or last  7 days

    Hi in my application there is log for who is logging and i want to find who logged for last 7 days or last week.i tried the following query and its not workinghow to fix it
    select uid,agentid ,logtime from agnt_mst
    to_date(to_char(logtime,'dd-mm'),'dd-mm') between to_date(to_char(sysdate,'dd-mm'),'dd-mm') and to_date(to_char(sysdate,'dd-mm'),'dd-mm') - 7;

    Here trying for one test table
    desc emp_benefit
    employee_number varchar2(30)
    employee_name varchr2(40)
    dob date
    select distinct employee_number,dob from emp_benefits
    WHERE trunc(dob) >= trunc(sysdate-5)
    it shoud return
    70935     Mrs. Mervatte      17-AUG
    74552     Mrs. Dona      18-AUG
    75331     Mrs. Ramesh     20-AUG
    76068     Mr. Fernandes     17-AUG
    72366     Ms. Rajaa      19-AUG
    rgds
    raj

  • Week function gives wrong result for last week in year

    Week(CreateDate(2011,12,25)) returns 51 - correct
    Week(CreateDate(2011,12,26)) returns 53 - wrong
    It looks like all last weeks of the year are 53 whereas the next year with 53 weeks should be 2015.
    See http://tuxgraphics.org/toolbox/calendar.html for example.
    I am running CF9 on Windows 7 with Java V6 update 29.
    This is causing me a problem. Any ideas for a workaround?
    Doug

    Here is my general solution for my cfc which seems to work for all dates up to 2100 at least.
    Hope it can help if you need a Week function to replace the CF one.
    <cffunction name="getISOWeekNum" access="public" returntype="Numeric" hint="Gets ISO week number in which date occurs.">
        <cfargument name="date" type="date" required="true" hint="Date for which you wish to know the week number">
        <cfset var weeknum = 0>
        <cfset var isLeap = isLeapYear(Year(date))>
        <cfset var dayInWeek = dayOfWeek(date)>
        <cfset var isoDayOfWeek = iIf(dayInWeek GT 1, dayInWeek - 1, 7)>
        <cfset var nearestThur = dateAdd("d", 4 - isoDayOfWeek, date)>
        <cfset var fourthDayOfYear = createDate(year(nearestThur), 1, 4)>
        <cfset var fourthDayInWeek = dayOfWeek(fourthDayOfYear)>
        <cfset var fourthIsoDayOfWeek = iif(fourthDayInWeek GT 1, fourthDayInWeek - 1, 7)>
        <cfset var firstThur = dateAdd("d", 4 - fourthIsoDayOfWeek, fourthDayOfYear)>
        <cfset var lastWeek = iIf(fourthDayInWeek EQ 8 OR (isLeap AND fourthDayInWeek EQ 7), 53, 52)>
        <cfset var firstIsoDayOfFirstWeek = dateAdd("d", -(fourthIsoDayOfWeek-1), fourthDayOfYear)>
        <cfset var firstIsoDayOfLastWeek = dateAdd("d", -7, firstIsoDayOfFirstWeek)>
        <cfset var lastIsoDayOfFirstWeek = dateAdd("d", 6, firstIsoDayOfFirstWeek)>
        <cfset var weekDiff = iIf(dateCompare(date, firstIsoDayOfFirstWeek, "d") EQ -1, 0, 1)>
        <cfif dateCompare(date, firstIsoDayOfFirstWeek, "d") EQ -1 AND dateCompare(date, firstIsoDayOfLastWeek, "d") NEQ -1>
            <cfset weeknum = lastWeek>
        <cfelseif dateCompare(date, lastIsoDayOfFirstWeek, "d") NEQ 1 AND dateCompare(date, firstIsoDayOfLastWeek, "d") NEQ -1>
            <cfset weeknum = 1>
        <cfelse>
            <cfset weeknum = weekDiff + (dateDiff("d", firstThur, nearestThur) / 7)>
        </cfif>
        <cfreturn weeknum>
    </cffunction>
    Doug

  • Calculate Dates for Last week and next three weeks

    Hi,
    I have a report where I need to calculate dates between last week and the next three weeks (not counting current week). I'm familar with the first part, it could be done by using the LastFullweek function but not sure how I can avoid the current week and calculate the next three weeks.
    Any help is greatly appreciated.
    Thanks!

    ... and here are a few more...
    Last Week...
    IF {TableName.Date} IN
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate), #1/7/1900#)
    To
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -1, #1/7/1900#)
    THEN TRUE ELSE FALSE
    The week before...
    IF {TableName.Date} IN
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -1, #1/7/1900#)
    To
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -2, #1/7/1900#)
    THEN TRUE ELSE FALSE
    And the week before that...
    IF {TableName.Date} IN
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -2, #1/7/1900#)
    To
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -3, #1/7/1900#)
    THEN TRUE ELSE FALSE
    and of course all 3 weeks together...
    IF {TableName.Date} IN
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate), #1/7/1900#)
    To
    DateAdd("ww", DateDiff("ww", #1/7/1900#, CurrentDate) -3, #1/7/1900#)
    THEN TRUE ELSE FALSE
    If you want the 1st day of the week to be Monday instead of Sunday just change the date of #1/7/190# to #1/1/1900#
    HTH,
    Jason

  • Unable to check plugins for 2 weeks now-error message-went to "help" & was warned I am using outdated version-so went to update but not available....any ideas? I am computer literate so you don't have to over-simplify your answer ; ) Thanks!

    I keep rec. an error message every time I try to do a plugin check. It says "error finding service" and asks me to try again later. I have been trying for a couple weeks now and still get the same error. I clicked on "help" and was brought to a page that told me I am using an "insecure version" of Firefox....(LOL "INsecure...like it's scared, not sure what to do?? Shouldn't that be UNsecure?) Anyway, I thought I had the most recent version but maybe not so I clicked on the link to update Firefox. That took me to a page that told me all about how Firefox automatically updates unless I opt for it NOT to do this (I have not opted out of this feature) etc etc etc.....and there is no button to click to update now. I am unable to rectify this problem and I think some of the plugins ARE out of date but because of the error message I keep getting I can't check on them or update them. Any ideas will be greatly appreciated. Thanks!

    I keep rec. an error message every time I try to do a plugin check. It says "error finding service" and asks me to try again later. I have been trying for a couple weeks now and still get the same error. I clicked on "help" and was brought to a page that told me I am using an "insecure version" of Firefox....(LOL "INsecure...like it's scared, not sure what to do?? Shouldn't that be UNsecure?) Anyway, I thought I had the most recent version but maybe not so I clicked on the link to update Firefox. That took me to a page that told me all about how Firefox automatically updates unless I opt for it NOT to do this (I have not opted out of this feature) etc etc etc.....and there is no button to click to update now. I am unable to rectify this problem and I think some of the plugins ARE out of date but because of the error message I keep getting I can't check on them or update them. Any ideas will be greatly appreciated. Thanks!

  • Very Slow.......... connection for last week

    Hi, ive been having very very slow speeds for the last 7-10 days speedtests showing anywhere between 200 kbps - 600 kbps which is obviously very bad, when i first move to this address about 2.5 months ago i was getting average of 5.5 mb which is a big diference. i have phoned bt who did test etc & got me to plug directly into master socket which didnt change anything, without going into all the problems ive had since moving i wonder if anyone who knows what there talking about tell me wether these stats from my home hub (black one) shed any light on the problem, also to point out i notice my phone line is a bit crackly when im using it
    ps im still directly connected to test socket with nothing else connected except my bt vision into the hub which when i disconnected didnt make any difference either so i have ruled that out. also just for information the connection usually drops 3-4 times of an evening & speedtester.bt.com showed my ip profile is 500 kbps or 1500 kbps on diferent days
    Connection information
    Line state
    Connected
    Connection time
    0 days, 0:22:29
    Downstream
    2,368 Kbps
    Upstream
    448 Kbps
    ADSL settings
    VPI/VCI
    0/38
    Type
    PPPoA
    Modulation
    ITU-T G.992.1
    Latency type
    Interleaved
    Noise margin (Down/Up)
    13.6 dB / 19.0 dB
    Line attenuation (Down/Up)
    34.0 dB / 20.0 dB
    Output power (Down/Up)
    19.8 dBm / 12.2 dBm
    Loss of Framing (Local)
    35
    Loss of Signal (Local)
    5
    Loss of Power (Local)
    0
    FEC Errors (Down/Up)
    0 / 0
    CRC Errors (Down/Up)
    0 / 2147480000
    HEC Errors (Down/Up)
    nil / 0
    Error Seconds (Local)
    4

    rather than try and explain it would be easier for you to read about at your leisure
    http://www.jarviser.co.uk/jarviser/homehubindex.html
    http://www.kitz.co.uk/adsl/IPprofile.htm
    http://www.kitz.co.uk/adsl/max_speed_calc.php
    If you like a post, or want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side of the post.
    If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’.

  • I am having terrible problems with Game Center when playing my games. It kicks me off and then I have to sign in again each time.  Been happening for last week.  So bad I can't play any more.  I've soft reset repeatedly changed my password and then reset.

    I Am having terribly time with Game Center.  Crashes constantly so I can't play my games.  Tried soft reset on ipad repeatedly also changed password and reset.  That seemed to work for a while but now it's messed up again.  When I try to contact support they say I don't have a server that they support and tell  me to use:  Safari , Firefox both of which I have...HELP!!! I'm a chancelor in one of my world!

    I Am having terribly time with Game Center.  Crashes constantly so I can't play my games.  Tried soft reset on ipad repeatedly also changed password and reset.  That seemed to work for a while but now it's messed up again.  When I try to contact support they say I don't have a server that they support and tell  me to use:  Safari , Firefox both of which I have...HELP!!! I'm a chancelor in one of my world!

  • TS1702 Star seek pro-sky week only shows info for last week in May

    StarSeek Pro. Skyweek only shows info from May

    That would be a question for the app's developer. Contact info should be available from the relevent page in the App Store.

  • Too many http redirects in App Store for last week now why?!?!

    What's up with this problem?

    See:
    AppStore Show "too many HTTP redirects"...: Apple Support Communities
    Likely a network problem beyond your control.

  • BADI/User Exit for Checking Conditions in TRM Transactions

    Hi  All,
    I have to check some conditions before saving the transaction FTR_CREATE. So that based on that condition it will be known that whether that transaction will save or not.  I found some BADIs, but those are particularly working for Money market and derivatives. For my Req, I need a BADI which will check conditions for both Money market and Securities.
    Exact req is, Based on Portfolio and PaymentAmount i have to restrict the transaction. Those will found in 2 tables VTBFHA and VTBFHAPO. But many BADIs doesnt contain VTBFHAPO.
    If any one working on TRM can u help me out ?

    >
    priya tavanam wrote:
    > Hi Frds,
    >
    > I am using the FTR_TR_GENERIC Badi.  In that one method is : EVT_TRANSACTION_SAVE_CHECK. In that one parameter is PI_PROXY_TRANSACTION. I want to get the attributes of Method A_TAB_CASHFLOW . That is  : A_TAB_CASHFLOW~BZBETR.
    -->whats ur code to read those values , it should be
    lt_cashflow[] = PI_PROXY_TRANSACTION->a_A_TAB_CASHFLOW [ ] ' .
    But i am unable to access this value in BADI. how access this. Can any one help me on this.

  • Microsoft Project Server 2010 - Need a query/report to show everyone who did not submit timesheet last week

    I need to create a MSPS 2010 query/report to send out to my project managers that show them everyone who did not submit their timesheet for the previous week.  I would like to be able to filter it by project/client but would settle for just a list
    of all unsubmitted timesheets at this point.  Every link I have found point to old reports for MSPS 2007 and the queries do not work because of schema changes between MSPS 2007 and 2010.  Please help!

    Thanks Elli!  Is there any way to also pull in the active resources that have not created a timesheet in the timeframe I am filtering on as well?
    Here is the query I had came up with.  Looks like I was on the right track...  I did two actually.  First one to give me a roll up list of employees with outstanding time sheets for last week and the hours, then the same data with an explosion
    by employee by project and also pull in their associated time sheet manager:
    --Everyone with an timesheet for last week where status  is not 'Approved' or 'Submitted'
    SELECT DISTINCT
            CONVERT(varchar(10),b.StartDate,1) + ' - ' + CONVERT(varchar(10),b.EndDate,1) as [Timesheet Date]
          , [ResourceName]
          , [TimesheetStatus]     
          , SUM([ActualWorkBillable]) as [Hours Entered]
      FROM 
        [dbo].[MSP_TimesheetLine_UserView] a
      , [dbo].[MSP_TimesheetPeriod] b
      WHERE
          a.PeriodUID = b.PeriodUID 
      and [TimesheetStatus] NOT IN ('Approved', 'Submitted')
      and DATEADD(dd,-7,GETDATE()) BETWEEN b.[StartDate] AND b.[EndDate]
      GROUP BY 
        b.[StartDate]
      , b.[EndDate]
      , [ResourceName]
      , [TimesheetStatus]
    GO
    --Everyone with an timesheet for last week where status  is not 'Approved' or 'Submitted' w/ Project/Customer explosion
    SELECT
     CONVERT(varchar(10),b.StartDate,1) + ' - ' + CONVERT(varchar(10),b.EndDate,1) as [Timesheet Date]
    , r.ResourceName AS [Resource Name]
    , [TimesheetStatus]     
    , [ProjectName]     
            , ([ActualWorkBillable]) as [Hours Entered]
    , isnull(rm.ResourceName,'<No Timesheet ManagerInformation Available>') AS [Timesheet Manager]
    FROM
          dbo.MSP_EpmResource_UserView r 
     LEFT OUTER JOIN
          dbo.MSP_EpmResource_UserView as rm 
       ON r.ResourceTimesheetManagerUID = rm.ResourceUID
    ,[MSP_TimesheetLine_UserView] as a
    ,[MSP_TimesheetPeriod] as b
    WHERE
          a.PeriodUID = b.PeriodUID 
      AND a.ResourceUID = r.ResourceUID
      AND  [TimesheetStatus] NOT IN ('Approved', 'Submitted')
      AND  DATEADD(dd,-7,GETDATE()) BETWEEN b.[StartDate] AND b.[EndDate]
      AND (r.ResourceIsActive = 1)
      AND (r.ResourceType = 2)
      AND (r.ResourceIsGeneric = 0)
    ORDER BY 
       r.ResourceName
     , ProjectName
    GO

  • STAD Report for last month

    Hi,
       Iam getting stad report for last one week,iam not getting the stad report for last month.i want to get stad report for particular day in last month.how to rectify the same.
    Thanku

    Hi,
    rsau/local/file /usr/sap/LID/DVEBMGS00/log/
    you will have to set DIR_AUDIT parameter instead of it.
    Set the following parameter with reference value:
    Parameter                                  Description                                   Reference Value
    DIR_AUDIT                  Directory for security audit files          S:\ECP-AUDIT\ECP\DVEBMGS00\ECP_security_audit_log
    FN_AUDIT                  Name of security audit file                   ECP_AUDIT_++++++++.AUD
    rsau/enable                  Enable the Security Audit Log                       1
    rsau/max_diskspace/local       Maximum space for security audit file                 2147483647
    rsau/max_diskspace/per_day  Maximum size of all security audit files per day            (If you wish, otherwise let it be default '0')
    rsau/max_diskspace/per_file      Maximum size of one single security audit file             (If you wish, otherwise let it be default '0')
    rsau/selection_slots              Number of filters to allow for the Security Audit Log            (If you wish, otherwise let it be default '2')
    rsau/user_selection              Defines the user selection method used inside kernel functions         (If you wish, otherwise let it be default '0')
    activated profile in sm19,still iam not getting audit log for last week in sm20.
    After Proper setting of Security Audit log parameters, the Application Server needs to be restarted to make the changes effective. You will only get the Audit Data since the activation of valid Security Audit parameter.
    Regards,
    Bhavik G. Shroff

Maybe you are looking for

  • HP Photosmart Plus B209a-m not compatible with Windows 8.1 - was with 8; please advise.

    Cannot activate printer with Windows 8.1; please advise.

  • Checkbox appears with text behind box in FORM

    Hello, i created a master detail page where i can also edit the master through a form (all on the same page). The check boxes in the reports are fine but in the form (to edit the master) the box appears with a text behind the box: Eigen Fust ?      "

  • Why does the ipad 3 never fully sync?

    I bought an ipad3 a few months ago, and had so much problem trying to sync it returned it a few days later.  I already had the ipad 1, and wanted to upgrade.  Very disappointed (because I LOVE my ipad) I was given a new one in the shop, only to find

  • What are you Page ins / Page Outs?

    Got 2Gb Ram (would love 4...but..yeah), MBP C2D 2.66Ghz and just installed Snow Leopard. Uptime about 16 hours, but spent all of this morning working with Illustrator CS4 and large AI / PDF files each of which was over 150Mb...and i mean opening and

  • Unable to access certain HTTPS websites

    This is a bit of an odd one.  I'm not a BT customer, but work in network operations for a number of companies. I'm aware of a large body of BT Broadband customers who can't access various websites over HTTPS. When they try and access the website the