一个sql查询 tablename:A表结构如下f1 f2 f3a b cd e fg h i我想实现 如果 f1的内容是%号是查询结果是全部内容,否则就是where f1='a'slect form A where f1='a' 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 declare @f1 varchar(10)set @f1='%' --'a'select form A where f1 like @f1 declare @f1 varchar(10)set @f1='%'select * from A where f1=(case @f1 when '%' then f1 else 'a' end) @f1可以作为传入的参数if (@f1 ='%')select * from A elseselect * from A where f1='a' select * from A where f1=(case f1 when '%' then f1 else 'a' end) 属性集的闭包问题 如何获取分页数据中某条记录的序号? 没人知道吗? 如何判断一个表的数据是否存在于另一个表 有拆分字符串的好办法么? {求助}win 2000server系统 安装SQL2000报错,配置服务器失败 朋友们,帮我推荐一本学习ms-sql 的好书 : ) 这个问题谁会!!!!!!! 问个问题呀。。SQL server 2008 可以连接mysql么? 有关于SQL的distinct 的用法 在MYSQL数据库中,怎么读取另一台机器上的SQLSERVER数据库的内容?(解决后马上给分!!!!) 问一个查询啊~希望能告诉我
set @f1='%' --'a'select form A where f1 like @f1
set @f1='%'
select * from A where f1=(case @f1 when '%' then f1 else 'a' end)
if (@f1 ='%')
select * from A
else
select * from A
where f1='a'