按这段名字排如何排
where 姓名 in ('陈太花','王伟梁','陈菊芳''张静','徐俭','陈敏','陈淑琴','李文花','谢丽萍','许惠瑛','周季俞','
张燕','陆军','盛春芳','陈家贵','李玉华','陆玲娣','鲁春娟','赵亮','徐渭')
where 姓名 in ('陈太花','王伟梁','陈菊芳''张静','徐俭','陈敏','陈淑琴','李文花','谢丽萍','许惠瑛','周季俞','
张燕','陆军','盛春芳','陈家贵','李玉华','陆玲娣','鲁春娟','赵亮','徐渭')
charindex('陈太花','王伟梁','陈菊芳''张静','徐俭','陈敏','陈淑琴','李文花','谢丽萍','许惠瑛','周季俞','
张燕','陆军','盛春芳','陈家贵','李玉华','陆玲娣','鲁春娟','赵亮','徐渭',col)
charindex(姓名,'陈太花','王伟梁','陈菊芳''张静','徐俭','陈敏','陈淑琴','李文花','谢丽萍','许惠瑛','周季俞','
张燕','陆军','盛春芳','陈家贵','李玉华','陆玲娣','鲁春娟','赵亮','徐渭')
张燕','陆军','盛春芳','陈家贵','李玉华','陆玲娣','鲁春娟','赵亮','徐渭')
order by charindex(','+姓名+',',',陈太花,王伟梁,陈菊芳,张静,徐俭,陈敏,陈淑琴,李文花,谢丽萍,许惠瑛,周季俞,
张燕,陆军,盛春芳,陈家贵,李玉华,陆玲娣,鲁春娟,赵亮,徐渭,')
张燕陆军盛春芳陈家贵李玉华陆玲娣鲁春娟赵亮徐渭')
我是这样写的也不对
where 姓名 in ('陈太花','王伟梁','陈菊芳','张静','徐俭','陈敏','陈淑琴','李文花','谢丽萍','许惠瑛','周季俞','
张燕','陆军','盛春芳','陈家贵','李玉华','陆玲娣','鲁春娟','赵亮','徐渭')
order by charindex(','+姓名+',',',陈太花,王伟梁,陈菊芳,张静,徐俭,陈敏,陈淑琴,李文花,谢丽萍,许惠瑛,周季俞,
张燕,陆军,盛春芳,陈家贵,李玉华,陆玲娣,鲁春娟,赵亮,徐渭,')..
张燕','陆军','盛春芳','陈家贵','李玉华','陆玲娣','鲁春娟','赵亮','徐渭')
order by charindex(','+姓名+',',',陈太花,王伟梁,陈菊芳,张静,徐俭,陈敏,陈淑琴,李文花,谢丽萍,许惠瑛,周季俞,
张燕,陆军,盛春芳,陈家贵,李玉华,陆玲娣,鲁春娟,赵亮,徐渭,')这样没问题
蠢方法:
select * from tb where 姓名 in ('陈太花')
union all
select * from tb where 姓名 in ('王伟梁')
union all
select * from tb where 姓名 in ('陈菊芳')
.
.
.
.
.
if object_id('test') is not null drop table test
create table test
(姓名 varchar(50))insert into test
select '陈太花' union all
select '王伟梁' union all
select '陈菊芳' union all
select '张静' union all
select '徐俭' union all
select '陈敏' union all
select '陈淑琴' union all
select '李文花' union all
select '谢丽萍' union all
select '许惠瑛' union all
select '周季俞' union all
select '张燕' union all
select '陆军' union all
select '盛春芳' union all
select '陈家贵' union all
select '徐渭' union all
select '李玉华' union all
select '陆玲娣' union all
select '鲁春娟' union all
select '赵亮'
select * from test
order by charindex(','+姓名+',',',陈太花,王伟梁,陈菊芳,张静,徐俭,陈敏,陈淑琴,李文花,谢丽萍,许惠瑛,周季俞,张燕,陆军,盛春芳,陈家贵,李玉华,陆玲娣,鲁春娟,赵亮,徐渭,')------------------
陈太花
王伟梁
陈菊芳
张静
徐俭
陈敏
陈淑琴
李文花
谢丽萍
许惠瑛
周季俞
张燕
陆军
盛春芳
陈家贵
李玉华
陆玲娣
鲁春娟
赵亮
徐渭没问题啊。