have serval date fields in my table that i need to perform calcualations to bring bring a certain # of items.
Fields:
RptDte Date filed closed always the last date of previous month--- 6/30 for this example
EntryDte Date item was entered into system --could be multiple dates
EffDte Date item was or will be effective.--could be multiple dates
My first critera needs to be
Any items with an EfftDte that is 2 months or prior from RptDte (6/30/2007) that was Entered (EntryDte Field) in May or June (m-1 or m-2) from current month.
Second criteria would be
Any items with an effdate that is 3 months or prior from Rptdte (6/30/2007) that was Entered (EntryDte Field) in June (m-1) from current month.
1 1628
Give these a try,,, They're in the same order as the criteria you posted. They may need a little tweaking depending if I understood what you're asking correctly or not. -
SELECT Item, rptDate, entryDate, effDate
-
FROM yourTable
-
WHERE (([effDate]<=DateSerial(DatePart('yyyy',[rptDate]), DatePart('m',[rptDate])-2,DatePart('d',[rptDate])))
-
And DatePart('m',[entryDate])=Month(now())-1 Or
-
DatePart('m',[entryDate])=Month(now())-2);
-
-
SELECT Item, rptDate, entryDate, effDate
-
FROM yourTable
-
WHERE effDate <= DateSerial(DatePart('yyyy',rptDate), DatePart('m',
-
rptDate)-3, DatePart('d', rptDate))
-
AND DatePart('m' ,entryDate) = Month(Now())-1
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: JP SIngh |
last post by:
Hi All
I need to calculate the number of working days between the two dates entered
on an ASP page. I am not that great a coder in ASP and was wondering if
someone can help.
Basically the...
|
by: SimonC |
last post by:
Help needed for a Javascript beginner.
As above in the subject... i need a javascript to run this, but not in
the form of a web-page. I want to calculate it between 2 fields in a
database that...
|
by: |
last post by:
Hello,
I am hoping someone else has thought about a date time calculation i need to
perform.
I would like to be able to calculate the number of "working minutes" between
2 dates, given my...
|
by: Steve |
last post by:
Hi all
How would I find out the average date when given a bunch of dates? For
example, I want to find the average length in time from the following dates:...
|
by: Chris Hill via .NET 247 |
last post by:
Hi
I'm a jnr developer in need of desparate help. Can anyone point me in the right direction for this problem:
I calculate the number of days between 2 user defined dates like this:
Dim...
|
by: George |
last post by:
Can someone tell me how to calculate the number of weeks between two dates.
Your help is appreciated.
Thanks, George
|
by: Tom |
last post by:
Hello, please help me, I need two write a C++ program that can
calculate the number of days between two dates.
|
by: archulu |
last post by:
hai
this is archulu. i am new to domapi.now my problem is in my project i am taken 2 domapi datepickers. what i am want Calculate duration between two dates which i am selected in that datepicker.
...
|
by: SuzK |
last post by:
I am trying to calculate in VBA in Access 2002 a moving average and update a table with the calculations. Fields in my WeeklyData table are
Week Ending (date)
ItemNbr (double)
Sales Dollars...
|
by: FishVal |
last post by:
IMHO, the following is not a how-to-do instruction to solve a particular problem but more a concept-proof stuff demonstrating possibilities of SQL.
So, let us say the problem is to calculate...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
| |