$sql = "SELECT m.*,p.place_title
FROM members_meetings mm,meetings m,places p
WHERE mm.meeting_id=m.meeting_id AND mm.member_id=$member_id AND m.cat_id=$cat_id AND m.place_id=p.place_id AND m.meeting_status<>0
ORDER BY mm.meeting_id DESC";
我有另一个表meeting_time_poll包含这些列:
poll_id
meeting_id
poll_closed
poll_dates
poll_times
我需要poll_id,其中meeting_time_poll.meeting_id = meeting.meeting_id 我怎么能把它放在sql中?
注意:并非所有来自桌面会议的meeting_id在meeting_time民意调查中都有对应
答案 0 :(得分:0)
这个怎么样?
$sql = "SELECT m.*,p.place_title, mp.poll_id
FROM
members_meetings mm,
meetings m,places p,
meeting_time_poll mp
WHERE
mm.meeting_id=m.meeting_id
AND mm.member_id=$member_id
AND m.cat_id=$cat_id
AND m.place_id=p.place_id
AND m.meeting_status<>0
AND mp.meeting_id=m.meeting_id
ORDER BY mm.meeting_id DESC";
我也建议使用JOIN
。