大连轮胎厂:[asp]order by的问题

来源:百度文库 编辑:神马品牌网 时间:2024/04/25 12:00:42
数据表table1结构内容如下:
ID | Title | Intro
-----------------------------------------
1 | ABCAA | ABCDEFABCDA
2 | ABCDA | ABCDEFA
3 | ABCDE | ABCD
我想实现查询:
查询table1表,并返回按Title或Intro中包含“A”字符最多的记录进行排序。
请问select * from table1 order by.......后面该怎么写,如何实现以上功能?
select * from table1
order by length (Title) - length (replace (Title, 'A')) desc

可以在SQL数据库下运行,但在Access下,就报错:
“未定义函数"replace"...
不知道有什么好的方法可以解决。

求一下Title和把A删除掉的Title长度之差:

select * from table1
order by length (Title) - length (replace (Title, 'A')) desc
;