Numeric Operators in SQL Where clauses
Hi Das,
I am not sure why you would ever need to do this but it is possible as long
as you CAST the integer to a character type.
select cast(some_numeric_column as text) from some_table where
cast(some_numeric_column as text) like ‘8%’
would find all rows where “some_numeric_column” begins with 8. The more
common case would be:
select some_numeric_column from some_table where some_numeric_column >=80
and some_numeric_column < 90
You should be aware that if you have large datasets and you're doing a LIKE
on a low-cardinality (lots of similar or same data) column, the query will
do a table scan (evaluate all rows) and performance will suffer.
Regards,
Clifford Ilkay
+1 647-778-8696
On Fri, Feb 2, 2018 at 4:04 PM, Das Goravani <das@goravani.com> wrote:
>
> Hi
>
> It’s OK to do this
>
> WHERE prod_name LIKE ‘[isearchtext]%’
>
> But not with numeric fields, in this case prod_name is character, and it
> works
> But if I try LIKE with a numeric field, it doesn’t work
>
> What is the equivalent or nearly similar for numeric fields
> Where you want to say “It begins this way”
>
> Thank you
>
> Das
> _____________________________________________________________
> Manage your list subscriptions at lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com
>
_____________________________________________________________
Manage your list subscriptions at lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com