xiaodai
xiaodai

Reputation: 16004

How to extract only numeric data from a sqlite?

I have a table in a sqlite with one column "A"

A
1
2
3
INF

The column "A" is defined as numeric. But it was read it from R so the INF was the R code for infinite.

How to obtain the max of A using SQLite sql? I tried

select
   max(a)
from
   table
where a != INF

and

select
   max(a)
from
   table
where a != "INF"

As you can see I noob at SQLite.

Upvotes: 3

Views: 157

Answers (2)

Shabbir Bhimani
Shabbir Bhimani

Reputation: 19

Extending on the answer by Matthew Plourde How about

select
   max(a)
from
   table
where a < 9e999

Upvotes: -1

Matthew Plourde
Matthew Plourde

Reputation: 44614

You can use something like 9e999 for Inf, e.g.,

select
   max(a)
from
   table
where a != 9e999

Upvotes: 2

Related Questions