[RESOLVED] select based on month in date field
Hi,
I want to select a range of information from a table using the date field, that is using the month. For example I need to be able to select all records for a particular month using the date field. My date field is of the format dd/mm/yyyy in the table.
Could someone help me please.
Re: select based on month in date field
Hi sunshine123;
What database are you using?
Re: select based on month in date field
Not at work, but a couple options come to mind. You could get the month using Month(somedate), using Mid(somedate, 4, 2), etc.
Code:
SELECT tblFoo.fldBar FROM tblFoo
WHERE Month(tblFoo.fldDate) = 04
.
.
SELECT tblFoo.fldBar FROM tblFoo
WHERE Mid(tblFoo.fldDate, 4, 2) = 04
Might be off a bit on syntax, but something like this.
Re: select based on month in date field
Hi there,
yep you are right. I tried it and it worked. Thanks so much.:)
I have one more problem...regarding date with the database though I'm not sure whether this should be posted in this section of the forum cos it involves c# datetime picker. I think I'll better post it there.
Re: select based on month in date field
Quote:
Originally Posted by sunshine123
...cos it involves c# datetime picker. I think I'll better post it there.
That would be appropriate.
If you consider this resolved, would you please pull down the Thread Tools menu and click the Mark Thread Resolved menu item? That will let everyone know that you have your answer.
Thank you. :)