slinky2000
Jun 7th, 2000, 06:11 AM
I have a database and I want to create a SQL statement within VB to extract only the dates in a particular field which have a specific month.
Any ideas?
Thanks in advance
Clunietp
Jun 7th, 2000, 09:30 AM
This is the query I generated using the Northwind database in SQL 7, the key here is using the Month function and the Year function. If you database has these functions, you should be all set
This will get the total number of monthly orders, the month, the year, and the total amount of freight shipped in that month. The month I have specified is #7 (July)
SELECT COUNT(*) AS OrderCount, MONTH(orderdate) AS TheMonth,
YEAR(orderdate) AS TheYear, SUM(freight)
AS TotalMonthlyFreight
FROM Orders
WHERE MONTH(orderdate) = 7
GROUP BY YEAR(orderdate), MONTH(orderdate)
Enjoy
Tom