Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Category String id; String name; boolean enabled; Product String id; String name; boolean enabled; int categoryId;
我需要搜索所有enabled实际具有products并且products应该enabled设置为的类别true。
enabled
products
true
我不是很擅长 SQL 查询,所以有人可以指点我正确的方向吗?
这里是:
SELECT Category.* FROM Category INNER JOIN Product ON Category.id=Product.categoryId WHERE Category.enabled = 1 AND Product.enabled=1 GROUP BY Category.id
我不确定你的数据库中的布尔值表示,假设它是 1/0