我有这个查询命令,但我想使用 JOIN 命令,我该怎么做。
SELECT `tkb_code`, `tko_code`, `sch_no`, `tkb_sea_name`, `tkb_mem_name`,
`tkb_BusStop_price`,`tkh_comment`, `tks_id`, `tkr_text`, `sale_f`,
`tkh_date`
FROM `ticket_booking`
WHERE tkh_updateby =60 AND tks_id =3 AND date( tkh_date ) = '2013-05-15' AND sale_f =1
AND tkb_code NOT IN (
SELECT tkb_code
FROM `ticket_booking`
WHERE tks_id =3 AND date( tkh_date ) = '2013-05-14'
)
AND tkb_code NOT IN (
SELECT tkb_code
FROM `ticket_booking`
WHERE tks_id =6 AND date( tkh_date ) = '2013-05-15' AND tkh_updateby =60
AND tkb_code IN (
SELECT tkb_code
FROM ticket_booking
WHERE tks_id =3
)
)
GROUP BY tkb_code
ORDER BY tkh_date, tkb_sea_name
有人告诉我,使用 JOIN 的性能很好。我想替换我的查询。