-1

My query is:

String _query = "select DISTINCT Y.CATE_CODE4 CATE_CODE, Y.CATE_NAME4 CATE_NAME,
                 0 IS_PRESET from G_MASTER X INNER JOIN CATEGORY_VIEW Y ON X.CATE_4 = Y.CATE_CODE4
                 where X.IS_SALE = 1 AND Y.IS_LOCKED4 = 0 AND Y.CATE_NAME2 not in ('XXXX')";

How does Android SQLite make db.query()?

taejun
  • 3
  • 3

1 Answers1

2

First of all you should read SQLiteDatabase reference.

You could use a rawQuery(), here's an example of it :

rawQuery - db.rawQuery("select DISTINCT Y.CATE_CODE4 CATE_CODE, Y.CATE_NAME4 CATE_NAME,
             0 IS_PRESETG_MASTER X INNER JOIN CATEGORY_VIEW Y ON X.CATE_4 = Y.CATE_CODE4 from table where X.IS_SALE = 1 AND Y.IS_LOCKED4 = 0 AND Y.CATE_NAME2 not in ('XXXX')"",new String[]{"data"});

It's just an example, you have to adapt your code to this.

Skizo-ozᴉʞS ツ
  • 19,464
  • 18
  • 81
  • 148
  • String _query = "select DISTINCT Y.CATE_CODE4 CATE_CODE, Y.CATE_NAME4 CATE_NAME, 0 IS_PRESET from G_MASTER X INNER JOIN CATEGORY_VIEW Y ON X.CATE_4 = Y.CATE_CODE4 where X.IS_SALE = 1 AND Y.IS_LOCKED4 = 0 AND Y.CATE_NAME2 not in ('XXXX')"; Cursor cursor = mDb.rawQuery(_query, null); it doesn't woking...T.T – taejun Mar 17 '15 at 11:26
  • 3
    I told you it was just an example how to do it... not the solution. – Skizo-ozᴉʞS ツ Mar 17 '15 at 11:27