求一个简化sql语句
select * from m_test
/*
运行结果:
cd1 cd2 cd3 cd4
30002 30003 30006 30001
30005 30001 30002 30009
*/
------------------------------------------------
select * from m_test2
/*
运行结果
cd mei
30001 a
30002 b
30003 c
30004 d
30005 e
30006 f
30007 g
30008 h
30009 i
*/
-------------------------------------------------
select m_test.cd1, (select mei from m_test2 where cd = m_test.cd1) as mei1,
m_test.cd2,
(select mei from m_test2 where cd = m_test.cd2) as mei2,
m_test.cd3,
(select mei from m_test2 where cd = m_test.cd3) as mei3,
m_test.cd4,
(select mei from m_test2 where cd = m_test.cd4) as mei4
from m_test
/*
运行结果:
cd1 mei cd2 mei ...
30002 b 30003 c ...
30005 e 30001 a ... 等等。
*/
问题,我该如何简化第3条语句呢?
------解决方案--