这个能不能用一条SQL语句写出来!如果表中有A=1的记录,则将A=1的记录选出来, select * from tablename where a in (1,2) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select top 1 * from tablename where a in (1,2) order by A select * from tablename where A = 1or (A=2 and not exists(select 1 from tableName where A=1)) select * from tablename where a=(case when exists(select 1 from tablename where A=1) then 1 else 2 end) select * from tablename a join ( select min(A) as A from tablename group by A where A in (1,2) ) b on a.A=b.A if(not EXISTS(select * from spt_server_info where 1=2)) select * from spt_server_info where 1=1 这样写行不行!? 关于like的用法,求指导 sql反选语句如何写? 菜鸟求一个sql语句 asp连接mssql的问题,高手赐教??? 请高手过来帮忙,在线急等。。。。。。。。 sql server企业管理器的管理中没有SQLServer代理怎么调 如何复制表中纪录 数据库在搜索或遍历全部数据时的速度是否与每条纪录的长度有关!?? MS SQL Server 7 数据库备份和恢复 如何为数据库起一个别名? 一sql查询问题! 数据导入问题
or (A=2 and not exists(select 1 from tableName where A=1))
from tablename a join
( select min(A) as A
from tablename
group by A
where A in (1,2)
) b
on a.A=b.A
这样写行不行!?