Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query Question

Author  Topic 

stevehatpa
Starting Member

21 Posts

Posted - 2008-06-04 : 12:02:08
I have one more question about SQL 2000.

I am creating a query in Design View. In the criteria section of a Year ID variable, I want to have the query always look for the records in the latest year(ex. 2008). Is there a simple expression to always find the "top" or "max" year?

Please let me know if more info is needed.

thanks.

-Steve H.

raky
Aged Yak Warrior

767 Posts

Posted - 2008-06-04 : 12:06:57
quote:
Originally posted by stevehatpa

I have one more question about SQL 2000.

I am creating a query in Design View. In the criteria section of a Year ID variable, I want to have the query always look for the records in the latest year(ex. 2008). Is there a simple expression to always find the "top" or "max" year?

Please let me know if more info is needed.

thanks.

-Steve H.


select * from tablename where yearID = year(GETDATE())
Go to Top of Page

stevehatpa
Starting Member

21 Posts

Posted - 2008-06-04 : 12:12:58
Perfect! Thanks for the assistance.
Go to Top of Page
   

- Advertisement -