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

Query by Month-Year and with a Record Count Field

Status
Not open for further replies.

0sprey

Technical User
May 9, 2015
81
0
0
CA
The 'Parts' Table contains a Date Field called [PURDATE] which contains the date the part was purchased.

I need a query to display parts purchased as a function of year and month of the purchase :

YEAR_MONTH COUNT OF RECORDS
2018-JAN 596
2018-FEB 456


Any thoughts on how best to accomplish this ?

KMD
 
Code:
Select FORMAT(PURDATE, “yyyy-mm”), COUNT(*)
FROM [MyTable]
GROUP BY FORMAT(PURDATE, “yyyy-mm”)

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top