有两个数据表,t1和t2,连接条件是t1.name=t2.name。但是数据里面有
t1.name t2.name
-------- --------
aaa aaaISO
bbb aaa
希望显示出 aaa aaaISO
aaa aaa
语句要是这样写,select * from t1 inner join t2 on t1.name like t2.name+'ISO'
只能显示出一条记录,即 aaa aaaISO
语句要是这样写,select * from t1 inner join t2 on t1.name =t2.name
只能显示出一条记录,即 aaa aaa
应该怎样写?
------解决方案--------------------
- SQL code
select * from t1 inner join t2 on t2.name like t1.name+'%'
------解决方案--------------------
t1.name like t2.name + '%'
------解决方案--------------------
- SQL code
SELECT *FROM t1INNER JOIN t2ON t2.name LIKE t1.name + '%'