Android SQL query with two Where clauses

Hello, I have an SQL query and I want it to have two WHERE clauses. I want him to request both Bid and Cid in my db and return it to the cursor, there is my code

     public Cursor getSubCategoriesQuerybyCidandBid(String Cid, int Bid) {
        this.openDataBase();
        Cursor c;
         String[] asColumnsToReturn = new String[] {SECOND_COLUMN_ID, SECOND_COLUMN_IDENTITY, SECOND_COLUMN_SUBCATEGORIES};
         c =dbSqlite.query(false, TABLE_NAME, asColumnsToReturn, COLUMN_BID + "=" + Bid + COLUMN_CID + "=" + Cid , null, null, null, null, null);
         return c;
    }

This is how I want it to be, but it doesn’t work any ideas how to fix it?

+3
source share
1 answer

Give it a try COLUMN_BID + "=" + Bid + " AND " + COLUMN_CID + "=" + Cid.

+7
source

All Articles