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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Month & Year Match Required

Status
Not open for further replies.

ooch1

MIS
Nov 4, 2003
190
GB
Hello,

I was hoping that someone could provid me with a formula for matching to dates, by month and year only/

I have tried format([date1],"mmyyyy")=format([date2],"mmyyyy"), but i assume this keeps the original dates and just makes them look different.

OOch
 
try YEAR(date1) = YEAR(date2) AND MONTH(date1) = MONTH(date2)

-------------------------
The trouble with doing something right the first time is that noboby appreciates how difficult it was.
- Steven Wright
 
I gotta ask.....

Since you posted this

format([date1],"mmyyyy")=format([date2],"mmyyyy"),

and Microsoft SQL Server (to my knowledge) does not use that syntax, have you posted in the wrong forum? This is for Microsoft SQL Server: Programming.

-SQLBill

Posting advice: FAQ481-4875
 
sql bill,

Since you asked, it is most definetly SQL, however when i have used it previously and the query ran fine, it was in the following context:
Code:
TRANSFORM nz(Sum([Number of MPANs]),0) AS Expr1
SELECT [SNFs].[New/Renewal], "02-MPANs" AS Proposal
FROM SNFs, Celendar
WHERE (((nz([Start Date])) Between Celendar![Month Start date] And Celendar![Month end date]) And (([SNFs].[Sales Channel Description]) Like "*conn*"))
GROUP BY [SNFs].[New/Renewal], "02-MPANs"
ORDER BY Format([Month],"mmmyy")
PIVOT Format([Month],"mmmyy") In ('Jan04','Feb04','Mar04','Apr04','May04','Jun04','Jul04','Aug04','Sep04','Oct04','Nov04','Dec04','Jan05','Feb05','Mar05','Apr05','May05','Jun05','Jul05','Aug05','Sep05','Oct05','Nov05','Dec05');

I hope this answers your query.

OOch
 
Folks, you are quite correct i am in the wrong forum.

Apologies, but thanks anyway!!!

OOch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top