How to make inner join on active android sqlite

141 views Asked by At

What I am trying to do is make a query in which I get the list of details that have a specific value field. The data base is as follow: a saleHeader is related to several details, each detail has a product. I want the list of details that have the product I pass and the saleHeader have specfic values.

public int getPendingProductQuantity(int idProduct){
    List<SaleDetail> presaleList = new Select().from(SaleDetail.class).innerJoin(SaleHeader.class)
                .on("SaleDetail.idSaleHeader = SaleHeaders.idSaleHeader")
                .where("SaleHeaders.preSale = 1 and SaleHeaders.idSaleHeader < 0 and SaleDetail.idProduct = ?", idProduct).execute();

}

I get an error that says

android.database.sqlite.SQLiteException: no such column: SaleDetail.idProduct(code 1)

Any help or suggestion would be great, thanks.

1

There are 1 answers

0
AudioBubble On

As I am working on a group project, didn't notice the table name was wrong. it is not "SaleDetail", but "SaleDetails" with an "s"