Monday, July 25, 2011

[android-developers] Sql query not working

Why this query is not working??

My date column has date like:2011-07-25.

final Calendar c =
Calendar.getInstance();
int myMonth = (c.get(Calendar.MONTH)+1);
int myDay = c.get(Calendar.DAY_OF_MONTH);

String query = " select * from table1 where (SUBSTR(date,6,2)== " +
myMonth + " AND SUBSTR(date,9,2)= " + myDay + " )
UNION ALL select * from table1 where (SUBSTR(date,6,2)== " + myMonth +
" AND SUBSTR(date,9,2)> " + myDay + " )
UNION ALL select * from table1 where SUBSTR(date,6,2)> " + myMonth +
"
UNION ALL select * from table1 where SUBSTR(date,6,2)< " + myMonth +
"; ";


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment