|
--I would need to know if is it possible to concato two fields inside the WHERE Clause
--Select * from myfile where (date|| time) >= 20160723180000
Yes its possible.
Should you do it? Probably Not.
IMO, the biggest reason not to cast in the were clause comes down to data access.
If you cast and then compare to some static value then you are forcing the SQL engine to retrieve each row from the database, perform a conversion, and then compare to some static value.
That has the potential to be extremely inefficient, especially for large databases.
You are "allowed" to do something like this:
Select * from myfile where CAST( (digits(date)|| digits( time)) as dec( 15,0 )) >= 20160723180000
However the most efficiently sql would be to just compare against the fields individually. This can be even more efficient if you have indexes over the "date" and "time" fields.
Select * from myfile where (("date" = 20160723 and "time" >= 180000 ) or "date" > 20160723)
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.
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.