1
SQLiteDatabase db = myDbHelper.getReadableDatabase();
cursor = db.rawQuery("SELECT * FROM tbl_ticket WHERE Updated_Time is null ",null);
while (cursor.moveToNext()){
int Ticket_No = cursor.getInt(cursor.getColumnIndex("Ticket_No"));
}

SQL i have tried

SELECT * FROM tbl_ticket WHERE Updated_Time is null

SELECT * FROM tbl_ticket WHERE Updated_Time = ''

SELECT * FROM tbl_ticket WHERE Updated_Time = 'null'

SELECT * FROM tbl_ticket WHERE Updated_Time = 'NULL'

ALL can't work, why?

John Walker
  • 1,121
  • 4
  • 26
  • 68
  • How is the column declared in the schema? What happens when you issue the first query: SELECT * FROM tbl_ticket WHERE Updated_Time is null? What did you expect? Also, take a look at: http://stackoverflow.com/questions/7519621/where-is-null-not-working-in-sqlite. In addition it is important to understand that ='' has nothing to do in SQL with IS NULL. Take sometime to know about nulls in SQL otherwise you may get wrong results. – NoChance Feb 21 '14 at 06:28
  • [weird](http://www.sqlfiddle.com/#!5/af7e4/6) – Alexander Feb 21 '14 at 06:40
  • No Idea, how come my sqlite can't work – John Walker Feb 21 '14 at 07:09
  • Can't reproduce in version 3.8.3.1. Edit your question, and paste the CREATE TABLE statement and a few INSERT statements. The right syntax is `SELECT * FROM tbl_ticket WHERE Updated_Time is null;`. – Mike Sherrill 'Cat Recall' Mar 07 '14 at 15:29

0 Answers0