|
-
Jun 7th, 2000, 06:11 AM
#1
Thread Starter
New Member
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
-
Jun 7th, 2000, 09:30 AM
#2
Guru
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|