|
On Thu, 2005-11-10 at 09:53 -0500, 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 > > > Don't use an expression to select the records, it results in a table scan. select * from SST30 where spplcd = '2' and (spcrdt > 20051103 or (spcrdt > 20051103 and spcrtm >= 0600)) and (spcrdt < 20051104 or (spcrdt = 20051104 and spcrtm <= 0200)) This was discussed several days ago. If you have indexes on the fields, the optimizer may be able to select the records without a table scan.
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.