Changed SQL select call to work with SQLite

Patch contributed by "Leaves in Motion".

Change-Id: Ib72b10287b2cd11d4a762cebb2136785a98cd9ed