首页 > 代码库 > IN的另类写法

IN的另类写法

EXPLAIN SELECT * FROM `tcb_capital_log` WHERE id IN(66,79,47)

EXPLAIN SELECT * FROM (
	SELECT 66 AS id UNION ALL
	SELECT 79 AS id UNION ALL
	SELECT 47 AS id
) AS tmp , tcb_capital_log WHERE
tcb_capital_log.id = tmp.id

  

IN的另类写法