简单问题——关于查询

xinxincao 2003-10-22 01:57:06
现有table(名为student),其中一字段名为no,取值为****01**,****50**,诸如此类
倒数三四位需要提取进行比较,将其在01至20的记录取出,并显示在dbgrid中,以及生成一个新表(名为result)
怎么写这段代码?
...全文
21 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
tiexinliu 2003-10-22
  • 打赏
  • 举报
回复
select * from student where substring(no,5,2) between '01' and '20'
into result
tiexinliu 2003-10-22
  • 打赏
  • 举报
回复
SELECT INTO 语句创建一个新表,并用 SELECT 的结果集填充该表。新表的结构由选择列表中表达式的特性定义:
select * from student where substring(no,5,2) between '01' and '20' newtablename

tulippopo 2003-10-22
  • 打赏
  • 举报
回复

select * from student where substring(no,5,2) between '01' and '20'
jin_zai 2003-10-22
  • 打赏
  • 举报
回复
是sqlserver的话:
select * from student where substring(no,5,2)=>'01' and substring(no,5,2)<='20'

2,497

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧