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
这样写不对
解决方案 »
- sql 语句查询一个表中不同的记录有多少条?
- 建立游标报错
- 在线等求解pl/sql语句在delphi就报错 急
- oracle dataguard :standby库在mount状态时,主库怎么传送日志?
- ORACLE10g的时候出现的问题,在查询结果中不能显示中文,出现的是问号,我改了注册表NLS_LANG的值为SIMPLIFIED CHINESE_CHINA.ZHS16GBK
- 谁能告诉我oracle知道字符串长度是那一个函数
- oracle客户端登陆远程oracle9i数据库服务器时测试连接报错!
- 请问新建一个实例,该给该实例的系统全局区(SGA)分配到大的内存空间合理?如要根据数据量的大小,那多大时,分配多大的空间?
- help me!导库问题
- 连接查询问题!
- 关于通信通道的文件结束
- 嵌套查询
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你想要什么结果