Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DATEPART Question

Status
Not open for further replies.

serino

Programmer
Feb 13, 2003
112
US
I have a DATEPART question. In the below statement I would only like to view the current year and have roll into next year without having to change the below statement each year.

Where and what do I insert to have the below query output the current year?

SELECT DISTINCTROW [SHIP INFO].Unit, Format$([PORT VISIT].[ARRIVAL_DATE],'\Qq yyyy') AS [ARRIVAL_DATE By Quarter], First([PORT VISIT].PORT_LOCATION) AS [First Of PORT_LOCATION]
FROM [SHIP INFO] LEFT JOIN [PORT VISIT] ON [SHIP INFO].[Record No] = [PORT VISIT].[Record No]
GROUP BY [SHIP INFO].Unit, Format$([PORT VISIT].[ARRIVAL_DATE],'\Qq yyyy'), Year([PORT VISIT].[ARRIVAL_DATE])*4+DatePart('q',[PORT VISIT].[ARRIVAL_DATE])-1;


Chuck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top