对于SQL 2005 [英] Between for SQL 2005

查看:71
本文介绍了对于SQL 2005的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



有人可以告诉我条件
的查询使用什么 我想在两个值之间选择一个值,但不想显示
在查询中使用的那些值.
我在sql 2005中使用的显示结果的查询
包括标准值之间的差值.
假设我的数据库有名称
shiv
syam
ram
arjun

monu
然后查询是
从学生中选择*,名字在"monu"和"syam"之间
o/p是
monu

shiv
syam
但我只希望输出支架

shiv
谢谢

解决方案

只需在查询中添加一个not in where条件(针对这两个名称).

select * from student where name between ''monu'' and ''shyam'' and name not in (''monu'', ''shyam'')


选择* from(从asc的学生订单中选择*),其中"monu"和"shyam"之间的名称


Hi,

can anybody tell me what is the query use for condition like
i want to select value between two value but do not want to show
those value which are use in query.
what ever query i am using in sql 2005 that are showing result
including between criteria value ex.
suppose my database have name
shiv
syam
ram
arjun
ratan
monu
then query is
select * from student where name between ''monu'' and ''syam''
o/p is
monu
ratan
shiv
syam
but i want output shold be only
ratan
shiv
Thanks

解决方案

Just add a not in where condition in the query (for these two names).

select * from student where name between ''monu'' and ''shyam'' and name not in (''monu'', ''shyam'')


select * from (select * from student order by asc) where name between ''monu'' and ''shyam''


这篇关于对于SQL 2005的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆