我想在以下情况下从mysql数据库中获取记录
我有以下表格:
organizationId | organizationname
camp_id | camp_name | adv_id | organizationId
adv_id | adv_name
ad_displayId | adv_id | camp_id |
现在,我要从ad_display表中获取记录,如下所示:
| adv_name | camp_name | organizationname
使用
WHERE
条件作为where OrganizationId ==?所以基本上我想要广告事件的广告列表,其中organization_id =?
最佳答案
试试这个:
SELECT ad.ad_displayId, a.adv_name, c.camp_name, o.organizationname
FROM ad_display ad
INNER JOIN advertise a ON ad.adv_id = a.adv_id
INNER JOIN campaign c ON ad.camp_id = c.camp_id
INNER JOIN organization o ON c.organizationId = o.organizationId
WHERE o.organizationId = ?;
关于mysql - 如何在MySQL中使用内部连接进行选择?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14067397/