我有一个名为“lists”的表、一个表“products”和一个表“lists_has_products”。
我的表列出:
- ID
- 姓名
- imgsrc
我的餐桌产品:
- ID
- 姓名
- imgsrc
- 类别ID
我的表lists_has_products:
- 列表ID
- 产品编号
我想选择 listid 等于 ... 的所有产品。
我怎样才能做到这一点?我已经尝试过了,但没有结果:(我正在使用 phonegap)
tx.executeSql("SELECT * FROM PRODUCTS p, LISTS_HAS_PRODUCTS l WHERE p.id = l.productid AND listid = " + listid, [], onSelectSupermarketsSuccess, onTxError);
他总是直接使用“onTxError”函数。这就是我填充 lists_has_products 表的方式:
tx.executeSql('INSERT INTO LISTS_HAS_PRODUCTS (listid, productid) VALUES (1, 2)');