#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    2
    Rep Power
    0

    Date Search by Last week/Month


    Hello All,

    This will be my first post on here. Plus I'm a new oracle user just started learning about 1 week ago.

    I have a create a report for our dept with certain criteria. So far what I need is a report that shows last weeks numbers or sign ups. I can't get the date search or between to work. Can someone help me on this?

    What I need is one for month end and one for last 7 days.


    here's what I have so far.



    select ap.name

    to_char(ap.opendate,'MM-DD-YY') "Open Date"


    from [databasname]

    where ap.opendate between databasename-7 and databasename-1


    I really don't want to change the date myself I want the system to know when the 7 days or month is.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    3
    Rep Power
    0
    Can you post sample data and create table script?
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    834
    Rep Power
    387

    Cool


    Originally Posted by Malachai
    ... Etc ...
    select ap.name
    to_char(ap.opendate,'MM-DD-YY') "Open Date"
    from [databasname]
    where ap.opendate between databasename-7 and databasename-1
    I doubt very much the rdbms you are using will allow you to subtract a number form the databasename string.

    Think about it and back to the drawing board...
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2011
    Posts
    2
    Rep Power
    0
    Originally Posted by LKBrwn_DBA
    I doubt very much the rdbms you are using will allow you to subtract a number form the databasename string.

    Think about it and back to the drawing board...
    Thank you both for trying to help me. I was able to figure out how to use the date search.

    AND (ap.boxes <'31-Oct-2011')
    AND (ap.boxes >'01-Oct-2011')
    search for previous month.


    --And this one too.

    where ap.boxes <> sysdate and ap.boxes >= sysdate-8
    search 7 days back.
  8. #5
  9. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    834
    Rep Power
    387
    Originally Posted by Malachai
    Thank you both for trying to help me. I was able to figure out how to use the date search.

    AND (ap.boxes <'31-Oct-2011')
    AND (ap.boxes >'01-Oct-2011')
    search for previous month.


    --And this one too.

    where ap.boxes <> sysdate and ap.boxes >= sysdate-8
    search 7 days back.
    Good!

IMN logo majestic logo threadwatch logo seochat tools logo