Hi, is there a way to query all days of a given month?
for ex: there should be 31 records for January..28 for february like that..
2 2289
Try this - When I want to Query all the days in a month - for example July1 thru July31 would be:
SELECT MyData
FROM MyTable
WHERE MyDate BETWEEN '20070701' AND '20070731'
The date format has to be the same as whats in your table - provided that you DO have a Date field.
Try this - When I want to Query all the days in a month - for example July1 thru July31 would be:
SELECT MyData
FROM MyTable
WHERE MyDate BETWEEN '20070701' AND '20070731'
The date format has to be the same as whats in your table - provided that you DO have a Date field.
just in case you don't have a datefield, put this in a function. it's currently defaulted to the current year. you can pass the year to the function, the code is already handling leap year... -
-
select top 12
-
datename(month,dateadd(ms,-3,dateadd(mm, datediff(m,0,cast(id as varchar(2))+'/01/'+cast(datepart(year,getdate()) as varchar(4)))+1, 0))),
-
datename(year,dateadd(ms,-3,dateadd(mm, datediff(m,0,cast(id as varchar(2))+'/01/'+cast(datepart(year,getdate()) as varchar(4)))+1, 0))),
-
datepart(dd,dateadd(ms,-3,dateadd(mm, datediff(m,0,cast(id as varchar(2))+'/01/'+cast(datepart(year,getdate()) as varchar(4)))+1, 0))) as numofday
-
from sysobjects
-
where id <= 12
-
order by id asc
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: cover |
last post by:
I have a form with drop down menus to query for name, month, and year
to capture activity accordingly by an individual for a given month and
given year. But I'd like to also be able to query ALL...
|
by: Chris |
last post by:
Having a little trouble returning the result I'm looking for in a
query and thought I'd ask a question here.
I have an input screen with a pull down menu to capture vacation
activity within a...
|
by: Fred Thompson |
last post by:
I'm using MS SQL 2000 server. I have a table which includes a date field
which has people's birthdays in it. How can I write a query to return all
the records of people with birthdays within the...
|
by: Dan |
last post by:
Hi all! I am creating a Disney "Today in History" database, and so
far have about 300 entries in it. Well, my Access database is great,
and my Frontpage form is great, but I want to include a...
|
by: colmobrien |
last post by:
Help Needed ms access 2000
I have a table where one field is the year end monthr (January,
February,........, December)
and another field is the year end day (1,2,3,........,31)
i want to...
|
by: Stan |
last post by:
I am working with Access 2003 on a computer running XP. I am new at
using Access. I have a Db with a date field stored as mm/dd/yyyy. I
need a Query that will prompt for the month, ie. 6 for...
|
by: burnside |
last post by:
Hi - long time viewer, first time poster
i have a car booking system that stores the startdate and the enddate of a booking as well as car/customer details.
i want to produce an efficiency report...
|
by: tbramley |
last post by:
Hi,
I've got a cross tab query which is sorted by area then month but the month is sorted in alphabetical order and I was wondering if this can be done in Month order e.g. April, May, June, July...
|
by: osward |
last post by:
Hi everyone,
Background
1. I have a table that consits 400+ rows of data and is growing by day. The table already has paging links at the bottom but I restricted to display rows of data only >=...
|
by: zion4ever |
last post by:
Hello good people,
Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |