473,657 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

4 New Member
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 4976
rski
700 Recognized Expert Contributor
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
anuragrathor
4 New Member
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 Recognized Expert Contributor
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
2821
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. Firstly here is the script to create the table and insert some sample data:
0
1339
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 i run the report and enter the date range parameters, no values are shown in my title. Am i doin something wrong?
2
1681
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 from 3:30 pm yesterday to 3:30 pm today. The query is automated to run at 3:30 everyday. I am unsure of hour to express hours in my date field parameter. Thanks in advance!!! Doug in Tallahassee
2
3846
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 of reports. You may add an option group or list box that selects which report you want printed, and a check box that determines whether the report should be opened in preview mode. I have tried several times to do this but can't figure it out....
0
3036
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 information,Passbook and Maintain different type of Accounts. I use VB inbuilt data report for reporting purpose. now my problem is i want do display one bank statement report from date to to date in data report. can any one help me for this task.
2
13995
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 into SQL view to change the date range. This is what I have so far: TRANSFORM Count(.ID) AS CountOfID SELECT ., Count(.ID) AS FROM
1
2337
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 date range. Eg. Between #1/01/2006# And #31/12/2007# - This would crash Between And - This would be OK Can someone please help!!
0
3679
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 : parameter 1 - From Collection Date parameter 2 - To Collection Date I should display the results base on this selection criteria : 1) specific date - to enter specific date in FROM and TO field eg 20071227 to 20071227 2) greater or equal date -...
2
2117
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 date i.e 1/1/08 and 31/1/08, the field name is Transaction Date and some dates have timestamps and some dont. Parameter >= And <= When entering the last date the query, if the transaction date record has a time stamp of 31/1/08 10:23 this is not...
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.