3

Hello i have an SQL query and i want it to have two WHERE clause. I want it to query both Bid and Cid in my db and return it to a 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 this is not working any ideas how to fix this?

1 Answer 1

7

Try COLUMN_BID + "=" + Bid + " AND " + COLUMN_CID + "=" + Cid.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.