[英]joining all columns of two tables in mysql conditionally
Mysql database has a tableA which has a many columns . Mysql数据库有一个tableA,其中有许多列。 one of the columns is SIM1.
列之一是SIM1。 Another table is tableB which has many columns .
另一个表是tableB,它具有许多列。 one of the columns is SIM2 the requirement is to join all columns of tableA and tableB given that SIM1 = SIM2.
列之一是SIM2,假设SIM1 = SIM2,则要求将表A和表B的所有列连接在一起。
LIKE THIS 像这样
tableA
col1 col2 SIM1 ..........col24
a x 1 5
b y 1 3
c z 0 2
d g 2 1
tableB
colA colB SIM2
x g 1
y f 0
x s 0
y e 2
The result of Select query should be 选择查询的结果应为
col1 col2 SIM1............col24 colA colB SIM2
a x 1 ........... 5 x g 1
c z 0 ......... . 2 x s 0
d g 2 .......... 1 y e 2
is it possible? 可能吗?
select * from tableA inner join tableB on tableA.SIM1 = tableB.SIM2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.