Subject RE: [firebird-support] Re: Select statement with Date
Author paul
Hi,
Thanks for your answer,
my logout field is Timestamp, and I want to compare date in the
Timestamp field. How to do it?

Any suggestions.

-----Original Message-----
From: Alan McDonald [mailto:alan@...]
Sent: Tuesday, 8 June 2004 9:40 AM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Re: Select statement with Date


> I have a some doubt about select statement using where clause is
> 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

You're trying to match, to the millisecond, a logout timestamp? It's
very
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






Yahoo! Groups Sponsor


ADVERTISEMENT

<http://rd.yahoo.com/SIG=1293vvhpm/M=298184.5022502.6152625.3001176/D=gr
oups/S=1705115386:HM/EXP=1086745413/A=2164339/R=0/SIG=11e2d64in/*http:/w
ww.netflix.com/Default?mqso=60183348> click here


<http://us.adserver.yahoo.com/l?M=298184.5022502.6152625.3001176/D=group
s/S=:HM/A=2164339/rand=150308483>

_____

Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe
>

* Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .


[Non-text portions of this message have been removed]