Is there any bug about this kind of SQL, and what kind of result shall we get from the following SQL statement?
select * from (select * from t1 where a=1) a1 left join t2 b1 on (a1.a=b1.a)
Is the following SQL different meaning from the above SQL?
select * from t1 left join t2 on (t1.a=1 and t1.a=t2.a)

~ 0 min
2016-02-03 10:05

The SQL statement 'select * from (select * from t1 where a=1) a1 left join t2 b1 on (a1.a=b1.a)' and 'select * from t1 left join t2 on (t1.a=1 and t1.a=t2.a)' means different. In fact, the second statement just like 'select * from t1 left join t2 on t1.a=t2.a where (t2.a=1)', the 'on' condition only used for join, not for the selection filter of t1.

Average rating 0 (0 Votes)

You cannot comment on this entry

Tags