select
case when charindex(',',id)>0 then left(id,charindex(',',id)-1)
else id
end as id
from
[table]
case when charindex(',',id)>0 then left(id,charindex(',',id)-1)
else id
end as id
from
[table]
解决方案 »
- 急??创建存储过程中遇到的超难问题??
- 求财务凭证管理数据库表
- 存储过程中数据类型转换
- 两个数据库取数据的问题,高手大侠帮帮我,谢谢
- 緊急:在把txt檔轉到sql時,出現如下問題:backup,checkalloc,bulk copy,select into...
- 数据导入!高分放送!
- 联接表的问题。
- 数据库连接问题,通过命名管道可以连接,通过TCP/IP有时连接正常,有时需要几十秒才能连上
- ODBC访问局域网上ACCESS数据库的问题?
- 怎样将一个txt文档中的部分数据导入到数据库中,求代码实现
- Sql Server高手看过来,"SQL Server 已为 8 个并发查询而优化。XX 个查询超过了此限制"错误
- 请问这个问题怎样解决?SQL启动不了
id,
case when charindex(',',id)>0 then left(id,charindex(',',id)-1)
else id
end as id1
from
[table]
select
......
from table1 a, table2 b
where
a.id1 = b.id2这里用id1是不行的吧 该用什么呢..