询:SQL这句怎么查
表一:
ID NAME
1 A
2 C
表二
A_ID B_ID
1 2
结果(A_ID) NAME_A (B_ID) NAME_B
1 A 2 C
如果我想一句SQL查出来,应该怎么办呢?
------解决方案--------------------select A_ID,(select name from tbl1 where A_ID=id ) as name_a
,B_ID ,(select name from tbl1 where b_ID=id ) as name_B
from tbl2