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.
相当简单,我有一个一对多/多对一的关系,我想查询它。但是,当没有提供任何 WHERE 子句信息时,我不希望返回任何结果。
简而言之,如何使查询不贪婪?
您可以添加一个始终为 false 的 where 子句,并附加您希望提供的条件 OR:
select * from table where 1 = 0 OR (real conditions)