Subject | RE: [firebird-support] Re: Select statement with Date |
---|---|
Author | Alan McDonald |
Post date | 2004-06-08T01:39:47Z |
> I have a some doubt about select statement using where clause isYou're trying to match, to the millisecond, a logout timestamp? It's very
> date
> Say, I have table with login and logout Date fields,
>
> I need to select the persons whoever logout todays or any of specified
> dates.
>
> I am using
>
> GregorianCalendar todayCal = new GregorianCalendar();
> java.sql.Date today = new java.sql.Date(todayCal.getTimeInMillis());
>
> "Select EmpName, EmpID from EMP where logoutdate='"+today+"';
>
> I didn't get any values, what is the correct statement for above
> situation.
>
>
> Regards,
> N.Paul
unlikely you will get a match at all.
You will need to cast the date as a date only, I would suggest, and make
sure you are comparing it with a date only as well - don't know the field
type you have, date/timestamp but using the < comparison will bring better
results
Alan