请如何使用inner转换此查询?
(SELECT DISTINCT tables.table_id AS 'Available table ID'
FROM tables, reservation
WHERE tables.table_id = reservation.table_id
AND ((start_time <> ? AND date = ?)
OR (date <> ?))
OR status = 1)
INTERSECT
(SELECT DISTINCT tables.table_id AS 'Available table ID'
FROM tables, reservation
WHERE tables.table_id = reservation.table_id
AND ((start_time <> ? AND date = ?)
OR (date <> ? AND reservation.table_id <> ?))
OR status=1)发布于 2014-04-22 07:20:36
你可以试试这个:(我不确定你是否在寻找这个答案)
(SELECT DISTINCT tables.table_id AS 'Available table ID'
FROM tables JOIN reservation
ON (tables.table_id = reservation.table_id)
WHERE start_time <> ? AND date = ?
OR (date <> ?))
OR status = 1
INTERSECT
(SELECT DISTINCT tables.table_id AS 'Available table ID'
FROM tables JOIN reservation
ON (tables.table_id = reservation.table_id)
WHERE start_time <> ? AND date = ?
OR date <> ? AND reservation.table_id <> ?)
OR status=1https://stackoverflow.com/questions/23207312
复制相似问题