Danny Watts
Danny Watts

Reputation: 579

Sqlite check if number is integer

I am trying to select a every field when a certain equation produces an integer which means a number that has no decimals. How can you do that in Sqlite?

Upvotes: 1

Views: 699

Answers (1)

crthompson
crthompson

Reputation: 15875

If you just want rows with out a decimal:

select 
   "(" + DatabaseOpenHelper.KEY_ROW_ID + " - 1)/4 + 1" as field
from 
   table
where 
   field not like '%.%'

EDIT:

Based on comments the calculated field has been added. SQLite supports using alias' in where clauses, so this should work for you.

Upvotes: 2

Related Questions