where 1=1 where 'a'='a' where '张三'='张三' .......... select * from tb 不要where 也行
declare @a table(id int ,name varchar(20)) insert @a select 1,'da' union all select 2,'dda' union all select 3,'gga' union all select 4,'djja' select * from @a where name like '%%' /* id name ----------- -------------------- 1 da 2 dda 3 gga 4 djja(4 行受影响) */select * from @a where id like '%%' id name ----------- -------------------- 1 da 2 dda 3 gga 4 djja(4 行受影响)
where 'a'='a'
where '张三'='张三'
..........
select * from tb
不要where 也行
declare @a table(id int ,name varchar(20))
insert @a select
1,'da' union all select
2,'dda' union all select
3,'gga' union all select
4,'djja' select * from @a where name like '%%'
/*
id name
----------- --------------------
1 da
2 dda
3 gga
4 djja(4 行受影响)
*/select * from @a where id like '%%'
id name
----------- --------------------
1 da
2 dda
3 gga
4 djja(4 行受影响)
LZ,你想实现什么功能说清楚点