語句出錯了,如下:
$_sql = "SELECT COUNT(*) FROM cms_content c,cms_nav n WHERE c.nav=n.id AND c.nav IN (SELECT id FROM cms_nav WHERE pid='$this->nav') OR c.nav='$this->nav'";
模型就是
SELECT * FROM tablename WHERE 條件1 AND 條件2 OR 條件3;
現在邏輯關系應該是(1 and 2) or 3;
我想要 1 and (2 or 3),請問怎樣才能實現呢? (我用括號或花括號框上2、3都不行。。)
SELECT * FROM tablename WHERE 條件1 AND 條件2 OR 條件1 AND 條件3;
如果條件1 是必須的話 就是這樣。