且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

忽略MySQL JOIN查询中的空结果

更新时间:2022-11-30 18:15:46

当您说结果为空时,表示没有产品?

When you say you have null results, you mean where there are no products?

无论如何,如果您的ID为空,则产品中没有结果,您也可以添加

Anyway, if you have null IDs, therefore, no result in products, you could just also add

where products.id is not null

或者,您可以将联接从左联接更改为仅联接,使其成为内部联接

or, you could change the join from left join to just join, making it an inner join