473,320 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to get data for a particular date range as a parameter

I have a "Date Range" Section, with these three items:-
Last full week; Last full month; Last full quarter. I want to get the data depending upon the selection of the Date Range.
  • If today is March 8th and I click on "last full week", the date range would actually 03/01/10 - 03/06/10. The last full week starting on Sunday and ending on Saturday.
  • If today is March 8th and I click on "last full month", the date range would be 02/01/10 - 03/01/10. It would go back the last full month available. March is not included because we haven't had a full month.
  • If today is March 8th and I click on "last full quarter", then the date range would be 12/01/2009 - 02/01/2010. The last full quarter (months).
This will obviously change as today's date changes. I am not sure how is this thing to be done. Please help.
Mar 15 '10 #1
3 4957
rski
700 Expert 512MB
If today is March 8th and I click on "last full week", the date range would actually 03/01/10 - 03/06/10. The last full week starting on Sunday and ending on Saturday.
The date you give is from monday till saturday (not from from sunday). Shouldn't there be 02/28/10-03/06/10?
Mar 15 '10 #2
Oh..Sorry my bad :-)
The date range should be 02/28/10 - 03/06/10 . i.e. from Sunday to Saturday.
Mar 17 '10 #3
rski
700 Expert 512MB
try this

last week
Expand|Select|Wrap|Line Numbers
  1. select to_char(next_day(sysdate+5,'MON') - interval '14' day) ||'<->'|| to_char(next_day(sysdate+5,'MON') - interval '8' day) as "LAST FULL WEEK" from dual;
  2.  
last month
Expand|Select|Wrap|Line Numbers
  1. select to_char(last_day(add_months(last_day(sysdate),-2))+1)||'<->'|| to_char(last_day(add_months(last_day(sysdate),-1))) as "LAST FULL MONTH" from dual;
  2.  

last quarter
Expand|Select|Wrap|Line Numbers
  1. select to_char(last_day(add_months(last_day(sysdate),-4))+1)||'<->'|| to_char(last_day(add_months(last_day(sysdate),-1))) as "LAST FULL QUARTER" from dual;
  2.  
Mar 17 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Sunny K | last post by:
Hi guys, whilst working on a project which I thought was nearly complete I have come across a problem which was some how over seen, which I am hoping one of you guys know how to resovle. ...
0
by: Massy | last post by:
Hi I have created a date-range parameter in crystal and i wanted to display the value of what the user has chosen in the title of the report I have dragged the parameter onto my report but when...
2
by: Doug1962 | last post by:
I would like to run a query every date to extract only the records that have been added to the database within my criteria for a 24 hour period. I.E. I would like the query to extract records...
2
by: Sara | last post by:
I have followed instructions on the http://allenbrowne.com/tips.html for limiting a report to a date range. At the bottom there is a note that says You will end up using this form for all sorts...
0
by: DhavalPatel1983 | last post by:
Hi, I need help in VB Datareport, my problem describe as below.... I have one Bank application project with all the information like Deposite,Clearness,Check,Cash,Creadit,ATM...
2
by: sixdeuce62 | last post by:
Hello, I am trying to create a query that will prompt me to enter the parameter value if beginning date and ending date. I have created everything I need in the query, but I have to manually go...
1
by: kappa | last post by:
I have a problem in ALL my queries when I run a specific date range. Access always crashes when I view in Datasheet view. This doesn't occur if it's a parameter query and I am prompted to enter the...
0
by: jans78 | last post by:
Appreciate if you all can help me to solve my Crystal Report problems First, I create some parameters and one of the parameters is Date. I set the parameter for the date is String. For example :...
2
by: Kerryn | last post by:
Hi all new to this site so looking for some help. I am working in Access 2002, using a select query. I am trying to use a date range parameter to allow the users to end the start date and end...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.