select T1.字段1,T1.字段2,T2.字段1,T2.字段2,T3.字段1,T3.字段2。。 from T1 join T2 join T3 on T1.x=T2.x and T2.x=T3.x where T1.y<MIN
MIN 什么? select * from t1 where exists(select * from t2 join t3 on t2.x = t3.x = t1.x and t1.y...)
select * from t1 where exists(select * from t2 join t3 on t2.x = t3.x = t1.x and t1.y < min) -------- ????
MIN是什么?declare @min int set @min = 100 select * form T1,T2,T3 where T1.y<@min and T1.x=T2.x and T1.x=T3.x
--应该没错,不过建议用下面的. select * from t1 a join t2 b on a.x=b.x join t3 c on a.x=c.x where a.y<[min]
--上面的方法效率高过你的,如果用你的,因为min是函数,所以要用: select *form T1,T2,T3 where T1.y<[MIN] and T1.x=T2.x and T1.x=T3.x
楼主你的语句的FROM写错为FORM了!:) select *from T1,T2,T3 where T1.y<MIN and T1.x=T2.x and T1.x=T3.x 建议使用zjcxc(邹建) 的!
SELECT * FROM T1 AS A LEFT JOIN T2 AS B ON A.X = B.X LEFT JONI T3 AS C ON A.X = C.X AND B.X = C.X WHERE T1.y<MIN这样可以了.TRY 一下! 关注!
declare @min int set @min = 100 select * form T1,T2,T3 where T1.x=T2.x and T1.x=T3.x and T1.y<@MIN--和select * form T1 join T2 on T1.x=T2.x join T3 on T1.x=T3.x where T1.y<@MIN--是一样的。楼主可以放入查询分析器看按ctrl+L看执行计划。
declare @min int set @min = 100 select * from T1,T2,T3 where T1.x=T2.x and T1.x=T3.x and T1.y<@MIN--和select * from T1 join T2 on T1.x=T2.x join T3 on T1.x=T3.x where T1.y<@MIN--是一样的。楼主可以放入查询分析器看按ctrl+L看执行计划。
所以楼主这条是对的。select * from T1,T2,T3 where T1.x=T2.x and T1.x=T3.x and T1.y<@你的min参数
select * from T1 join T2 on T1.x=T2.x join T3 on T1.x=T3.x where T1.y<[MIN]这条就可以了!楼主的是对的!
from T1 join T2 join T3
on T1.x=T2.x and T2.x=T3.x
where T1.y<MIN
select * from t1
where exists(select * from t2 join t3 on t2.x = t3.x = t1.x and t1.y...)
where exists(select * from t2 join t3 on t2.x = t3.x = t1.x and t1.y < min)
--------
????
set @min = 100
select * form T1,T2,T3 where T1.y<@min and T1.x=T2.x and T1.x=T3.x
select * from t1 a
join t2 b on a.x=b.x
join t3 c on a.x=c.x
where a.y<[min]
select *form T1,T2,T3 where T1.y<[MIN] and T1.x=T2.x and T1.x=T3.x
select *from T1,T2,T3 where T1.y<MIN and T1.x=T2.x and T1.x=T3.x
建议使用zjcxc(邹建) 的!
FROM T1 AS A
LEFT JOIN T2 AS B ON A.X = B.X
LEFT JONI T3 AS C ON A.X = C.X AND B.X = C.X
WHERE T1.y<MIN这样可以了.TRY 一下!
关注!
set @min = 100
select * form T1,T2,T3 where T1.x=T2.x and T1.x=T3.x and T1.y<@MIN--和select * form T1 join T2 on T1.x=T2.x join T3 on T1.x=T3.x where T1.y<@MIN--是一样的。楼主可以放入查询分析器看按ctrl+L看执行计划。
set @min = 100
select * from T1,T2,T3 where T1.x=T2.x and T1.x=T3.x and T1.y<@MIN--和select * from T1 join T2 on T1.x=T2.x join T3 on T1.x=T3.x where T1.y<@MIN--是一样的。楼主可以放入查询分析器看按ctrl+L看执行计划。