jeudi 21 avril 2016

Android SQLite date query

I have been trying to make a query that will show all Names of products that are going seeing their expiry date in the next 30 days.

My table variables are

// Database name
public static final String DATABASE_STOCKDB = "Stock.db";
// Collum names
public static final String TABLE_NAME = "stock_table";
public static final String COL_1 = "ID";
public static final String COL_2 = "Name";
public static final String COL_3 = "Datereceived";
public static final String COL_4 = "Expirydate";

So, i want to produce a query that shows the name (COL_2) As well as the expirydate (COL_4) If they are within 30 days of the current date set on the device.

Failing that i will just need to put them in ascending order.

(The information gathered by expiry date is in DATE formatting, yyyy:mm:dd)

Aucun commentaire:

Enregistrer un commentaire