如果嵌套[查询](https://geek.csdn.net/educolumn/52858a23fd7979423d613db72f18dba0?spm=1055.2569.3001.10083)返回多行数据,可以使用关键字 `IN` 来[解决](https://geek.csdn.net/educolumn/03368addd5d267af1b4c6df01bb4af26?spm=1055.2569.3001.10083)这个问题。下面是修改后的 SQL [查询](https://geek.csdn.net/educolumn/52858a23fd7979423d613db72f18dba0?spm=1055.2569.3001.10083):
```sql
SELECT
a.id,
a.asn_no,
b.wamng
sap_delivery_note AS a
JOIN sap_delivery_note_detail AS b ON b.sap_delivery_note_id IN (SELECT id FROM sap_delivery_note)
这样修改后,[子[查询](https://geek.csdn.net/educolumn/52858a23fd7979423d613db72f18dba0?spm=1055.2569.3001.10083)](https://geek.csdn.net/educolumn/251a67ccf9d4317480902b30e2a89676?spm=1055.2569.3001.10083)会返回 `sap_delivery_note` 表中的所有 `id`,并将其与 `sap_delivery_note_detail` 表中的记录进行匹配。