473,396 Members | 2,109 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,396 software developers and data experts.

Show past 3 years

I need a query to include a field called SettlementDate.

When the user runs the query, I need to prompt for "Enter Year" and
show the last three years of SettlementDate.

Can seem to get the logic down.

Thanks
Mar 24 '08 #1
3 1527
BerkshireGuy wrote:
I need a query to include a field called SettlementDate.

When the user runs the query, I need to prompt for "Enter Year" and
show the last three years of SettlementDate.

Can seem to get the logic down.

Thanks
I tried this SQL
SELECT ID, DateEntered, Year([DateEntered]) AS Expr1
FROM Table1
WHERE Year([DateEntered] Between [Enter Year] And [Enter Year]+2;

Seemed to work.

Dirty
http://www.youtube.com/watch?v=JjQ4SmptIyQ
Mar 24 '08 #2
Thanks - I was just going to post that I did:

SQL Select Year(SettlementDecisionDT) ...... ....
FROM Mytable
Where
Year([SettlementDecisionDT]))>=[Enter Year]-3));

So basic. Coffee hadn't kicked in. :)

Thanks

On Mar 24, 11:12*am, Salad <o...@vinegar.comwrote:
BerkshireGuy wrote:
I need a query to include a field called SettlementDate.
When the user runs the query, I need to prompt for "Enter Year" and
show the last three years of SettlementDate.
Can seem to get the logic down.
Thanks

I tried this SQL
SELECT ID, DateEntered, Year([DateEntered]) AS Expr1
FROM Table1
WHERE Year([DateEntered] Between [Enter Year] And [Enter Year]+2;

Seemed to work.

Dirtyhttp://www.youtube.com/watch?v=JjQ4SmptIyQ
Mar 24 '08 #3
BerkshireGuy <be*************************@yahoo.comwrote in
news:13b0ebce-7c2f-452e-9eb6-
60**********@t54g2000hsg.googlegroups.co
m:
Thanks - I was just going to post that I did:

SQL Select Year(SettlementDecisionDT) ...... ....
FROM Mytable
Where
Year([SettlementDecisionDT]))>=[Enter Year]-3));

So basic. Coffee hadn't kicked in. :)
It won't work when you enter a date 4 or more years ago. You'll get
the three years you want plus all the more recent data
>
Thanks

On Mar 24, 11:12*am, Salad <o...@vinegar.comwrote:
>BerkshireGuy wrote:
I need a query to include a field called SettlementDate.
When the user runs the query, I need to prompt for "Enter Year"
and show the last three years of SettlementDate.
Can seem to get the logic down.
Thanks

I tried this SQL
SELECT ID, DateEntered, Year([DateEntered]) AS Expr1
FROM Table1
WHERE Year([DateEntered] Between [Enter Year] And [Enter Year]+2;

Seemed to work.

Dirtyhttp://www.youtube.com/watch?v=JjQ4SmptIyQ



--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Mar 24 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

77
by: nospam | last post by:
Reasons for a 3-tier achitecture for the WEB? (NOTE: I said, WEB, NOT WINDOWS. DON'T shoot your mouth off if you don't understand the difference.) I hear only one reason and that's to switch a...
44
by: Mariusz Jedrzejewski | last post by:
Hi, I'll be very grateful if somebody can explain me why my Opera 7.23 (runing under linux) doesn't show me inner tables. Using below code I can see only "inner table 1". There is no problem with...
11
by: mlf | last post by:
Is there a clever way, or any way for that matter, to have a nested list show 1.1, 1.2, 1.3...2.1, 2.2, etc?
20
by: WindAndWaves | last post by:
Hi Gurus I was wondering if you can send me in the right direction: I have a table with about 300 rows. I want to make all of them invisible and when a user enters a code in a form then make...
5
by: Stu | last post by:
Does any body have any "C" code, which there willing to share, that can normalize a tm structure, which goes past the 2038 EPOCH. For example, I have the following tm stucture, which is set to...
13
by: Lloyd Sheen | last post by:
I am out of my mind fighting with the IDE HTML editor. Beyond the fact that reformatting the text is brain dead (and I am not just talking about the switching from design to HTML). I am putting...
7
by: Rudy | last post by:
Hello All! After working in the television industry, moving to a developing career has been interesting to say the least. 3 years of developing with books, and the help of you fine folks on this...
10
by: CSharpguy | last post by:
I have a drop down where I'm showing 3/31/2006 and the passed 5 years, I need to also show month end for the following year and still show the passed 5 . So I need 12/31/2007 and back 5 years...
130
by: Daniel Manes | last post by:
I'm baffled. I have a column in a SQL Server Express database called "Longitude," which is a float. When I view the table in a DataGridView, some of the numbers, which only have two decimal places...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.