select id,
SUBSTR(id,1,4)
select table
我想将SUBSTR(id,1,4) 翻译成name,怎么弄===================
select
id,
SUBSTR(id,1,4) as la ,
(select name from table where id=la ) as name_fy
select table
这样写不对
SUBSTR(id,1,4)
select table
我想将SUBSTR(id,1,4) 翻译成name,怎么弄===================
select
id,
SUBSTR(id,1,4) as la ,
(select name from table where id=la ) as name_fy
select table
这样写不对
select
id, (select name from table where id=SUBSTR(id,1,4)as name_fy
select table
最后是from table 吧
select
id, (select name from table where id=SUBSTR(id,1,4)as name_fy
from table --------------
name_fy 列没内容
id,
(select name from table t1 where t1.id=SUBSTR(t.id,1,4) ) as name_fy
from table t
这样能执行,但数据多的话,效率可能比较差,用表关联可能好些
是没去空格,加上trim就好了。
id name
------------
00010 name1
00011 name2
00012 name3你想要什么结果