|
Besides, it is not a good idea to aply any function to the data in the database for comparing, because it will cause it to ignore indexes, in the cases where they can speed up the select.
I sugest: ( spcrdt > 20051103 or spcrdt = 20051103 and spcrtm >= 600 ) and ( spcrdt < 20051104 or spcrdt = 20051104 and spcrtm <= 200 ) ___________________________________________________________________ Brian Piotrowski wrote:
Hi All, I have an SQL statement that has this: select * from SST30 where spplcd ='2' and concat(char(spcrdt),char(spcrtm)) >='20051103600' and concat(char(spcrdt),char(spcrtm)) <='20051104200' order by spcrdt, spcrtm When I run the statement, I get a list of records between 2005/11/04 7:43 am and 2005/11/05 19:04pm. However, the records I am expecting it to return should be between 2005/11/03 6:00am and 2005/11/04 2:00am. I did check our DB2 table, and there indeed records in there from 2005/11/03 6:56am and 2005/11/03 22:23pm. Why doesn't this statement pick up these records? Does it have something to do with using the concat command and converting the values to characters? If so, is there a better way to handle this conversion?
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.