I am using a HTML file in which i getting 6 parameters . 3 for from & 3 for to means month,date & year for from & same for to.means i want to display data like select * from table where dateofbirth falls between from and to.. how i can solve this problem
Joined: Jan 07, 1999
"rosei2000", The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements. Thanks.
select * from tblname where birthdate > to_date( fromMM | | fromDD | | fromYYYY, 'MMDDYYYY') and birthdate < to_date( toMM | | toDD | | toYYYY, 'MMDDYYYY') [This message has been edited by Daniel Dunleavy (edited June 07, 2001).]
Joined: Jun 12, 2001
Hi! Just to add on, if u want to do a select from date1 to date2, I think its advisable to store your dates in the following string format in your database : yyyymmdd, eg, 19990101 and 20001212. So, to search for dates between 1/1/1999 and 12/12/2000, all you have to do is to search for strings between 19990101 to 20001212. It'll also save you some time since all you need to do is to concatenante the year, month and day fields to produce the search string. Any comments anyone?