samedi 20 décembre 2014

SQLite - selecting non-null values from two columns

In my SQL table, there is a column for image paths and a column for video paths. I'm in the process of creating a gallery and I want to select all image and video paths from my table that are not null.


I think this is the way to retrieve all non-null values from one column:


Cursor cursor = mDatabase.query(TABLE_NAME, null, COLUMN_1 + " IS NOT NULL", null, null, null, null);


I would then add all these Strings to an array and return the array. But is there a way to run through the table just once and grab all non-null values from two columns? I'm new to SQL so I'm not sure. I would want to grab all the paths in the order they were added to the table, so the gallery is in chronological order.


Any advice is appreciated. Thanks!


Aucun commentaire:

Enregistrer un commentaire