不会吧,四星将问这么简单的问题? select * from 表 order by cast(第一关键字 as int),第二关键字还是另有...?
是不是还包含了万一不是纯数字的问题? 那再加个isnumeric判断 select * from 表 order by (case when isnumeric(第一关键字)=1 then cast(第一关键字 as int) end ,第二关键字
少了一边括号。 select * from 表 order by (case when isnumeric(第一关键字)=1 then cast(第一关键字 as int) else NULL end) ,第二关键字
create table temp (age char(10), xm char(10) )insert into temp(age,xm) values ('20','a') insert into temp(age,xm) values ('20','d') insert into temp(age,xm) values ('21','c') insert into temp(age,xm) values ('20','d') select * from temp /* 有两种方法 */ select * from temp order by cast(age as int),xm select * from temp order by age+0 ,xmdrop table temp 表一 20 a 20 d 21 c 20 d 表二 20 a 20 d 20 d 21 c 表三 20 a 20 d 20 d 21 c
select * from 表 order by (case when isnumeric(第一关键字)=1 then cast(第一关键字 as int) else NULL end) ,第二关键字 ========================= 不行.
select * from 表 order by (case when isnumeric(第一关键字)=1 then cast(第一关键字 as int) else NULL end) --不行是因为这个 括号是中文的!!! 搞得我郁闷了几分钟 ,第二关键字
SELECT * FROM [5] order by (CASE WHEN isnumeric(工序号) = 1 THEN cast(工序号 AS int) ELSE NULL END) desc =================================================================== 在Access中不行 语法错误(操作符丢失)在SQL中可以.
IsNumeric()在access里直接返回 TRUE 然后 不知道Access到底由没有 类似case 的语句如果有 直接 SELECT * FROM [5] order by (CASE WHEN isnumeric(工序号) THEN cast(工序号 AS int) ELSE NULL END) desc
变通一下: SELECT * FROM [5] where isnumeric(工序号) order by cast(工序号 AS int) desc union SELECT * FROM [5] where not isnumeric(工序号) order by 工序号 可以吗?
忘了加上top ============================= 请问加在那?
试了一下 没办法变通。union 的时候不能top
为什么office 2003的帮助我不知道怎么用?!郁闷
SELECT t.* FROM [5] t,[5] t2 where t.工序号*=t2.工序号 and t2.工序号<='9' order by cast (t2.gh as int)
select * from 表 order by cast(第一关键字 as int),第二关键字还是另有...?
那再加个isnumeric判断
select * from 表 order by (case when isnumeric(第一关键字)=1 then cast(第一关键字 as int) end ,第二关键字
select * from 表 order by (case when isnumeric(第一关键字)=1 then cast(第一关键字 as int) else NULL end) ,第二关键字
(age char(10),
xm char(10)
)insert into temp(age,xm) values ('20','a')
insert into temp(age,xm) values ('20','d')
insert into temp(age,xm) values ('21','c')
insert into temp(age,xm) values ('20','d')
select * from temp
/* 有两种方法 */
select * from temp order by cast(age as int),xm
select * from temp order by age+0 ,xmdrop table temp
表一
20 a
20 d
21 c
20 d
表二
20 a
20 d
20 d
21 c
表三
20 a
20 d
20 d
21 c
=========================
不行.
,第二关键字
SELECT * FROM [5] order by (CASE WHEN isnumeric(工序号) = 1 THEN cast(工序号 AS int) ELSE NULL END) desc
===================================================================
在Access中不行
语法错误(操作符丢失)在SQL中可以.
然后 不知道Access到底由没有 类似case 的语句如果有 直接
SELECT * FROM [5] order by (CASE WHEN isnumeric(工序号) THEN cast(工序号 AS int) ELSE NULL END) desc
SELECT * FROM [5]
where isnumeric(工序号)
order by cast(工序号 AS int) desc
union
SELECT * FROM [5]
where not isnumeric(工序号)
order by 工序号
可以吗?
=============================
请问加在那?
FROM [5] t,[5] t2
where t.工序号*=t2.工序号 and t2.工序号<='9'
order by cast (t2.gh as int)
msn:[email protected]
order by ...+0 不是可以?
SELECT * FROM [5] order by iif(工序号 not like '%[^1234567890]%',工序号) desc,..
在access的sql视图中不行
但用vc调用时,可以
????