sql简单语句求解 A表有一int型字段ID我现在传进来一个条件,要跟ID的前5位进行比较select * from A where (ID)前5位 = 条件这个怎么写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from A where substring(cast(id as char(20)),1,5) = 条件 select * from A where left(ltrim(ID),5)=条件 select top 5 * from A WHERE in(。) select * from A where left(ltrim(ID),5) = 条件 截取字段 substringselect * from A where substring(ID,0,5) =12345select * from A where left(ID,5) = 12345 select * from A where left(ltrim(ID),5)=条件 int 不用强制转换的,系统会默认变为字符 [Quote=引用 2 楼 qianjin036a 的回复:]select * from A where left(ltrim(ID),5)=条件 关于排行的问题,请大家各抒己见 分頁 SQL SERVER不能写入???????? 问一个关与表删除的问题 SqlServer2005,主从表是同一张表,如何使用删除规则 中文查询出来是乱码 怎么给我的查询结果加个序列号??? 在局域网中的SQL SERVER连接 请问SQL SERVER里面怎么使用临时表,举个列子?多谢!! 存储过程反回的记录集问题? 存储过程默认参数问题 查询问题
select * from A where left(ltrim(ID),5) = 条件
select * from A where substring(ID,0,5) =12345
select * from A where left(ID,5) = 12345