假设我有2张像贝娄这样的表:
T1
+-----------+------------+
| repoName | repo_build|
+-----------+------------+
| 14B | CSX_12 |
+-----------+------------+
| 15A | CSX_13 |
+-----------+------------+
T2
+------------+----------+
| CSX_12 | CSX_13 |
+------------+----------+
从此我想得到以下选择
select old_repo,new_repo from t1 where ProductIdD='1'
那就是我想得到old_repo和new_repo的repo_build,它位于t1中,其中t1中的ProductID ='1'。怎么办呢?
Policy.cshtml
提前致谢。
答案 0 :(得分:1)
尝试以下方式:
SELECT a.repo_build
,b.repo_build
FROM t1
LEFT JOIN t2 a ON a.repoName = t1.old_repo
LEFT JOIN t2 b ON B.repoName = t1.new_repo
where ProductID ='1'