DaNuGai Posted December 1, 2006 Share Posted December 1, 2006 Is is a little bit different question then what I have seen people ask here.....I have a table called Event. In the table I have a date field. I want to Select specific fields and retrive events from the begining of this month to the end of february. In other words, 3 months span.This is what I have, SELECT EventDate, EventID, EventTitle, Event, DeptCodeFROM EventsWHERE DeptCode == '2'ORDER BY EventDate ASC Now my question is where/how do I ask for events in 3 monts span.Please Help. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 1, 2006 Share Posted December 1, 2006 Use a function to add 3 months to the current date, and get all events within the start and end dates. Depending on what database you are using, the function name and syntax may be a little different. Link to comment Share on other sites More sharing options...
DaNuGai Posted December 2, 2006 Author Share Posted December 2, 2006 Use a function to add 3 months to the current date, and get all events within the start and end dates. Depending on what database you are using, the function name and syntax may be a little different.First of all, thank you for your help.I am using MySQL. I am using an application that can access MySQL where I would be putting the code. Everything works with the code I posted above expcept filtering data to 3 month period. I not very familiar with MySQL, I just know how to do the basics. I don't think I know how to write a function. Is there any link that you can refer me to.Thanks once again.... Link to comment Share on other sites More sharing options...
justsomeguy Posted December 4, 2006 Share Posted December 4, 2006 This should help you out. There are several user comments at the end as well:http://dev.mysql.com/doc/refman/5.0/en/dat...-functions.html Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now