Really liked a solution I saw recently for an alternative to using an OR clause in a join, as in
select t1.blah, t2.blah from t1
inner join t2 on t1.id = t2.id
or t1.id = t2.id2
instead, try it like this
select t1.blah, t2.blah from t1
inner join t2 on t1.id = t2.id
union
select t1.blah, t2.blah from t1
inner join t2 on t1.id = t2.id2
Nice and elegant, I think. I'll have to explain it better later :-)
No comments:
Post a Comment