SQL Fun

Posted by: scoopseven 17 years, 7 months ago

select a.*, ba.column1, bb.column1 from tablea a join tableb ba on a.column1 = ba.column1 and ba.column2 = 'string' join tableb bb on a.column1 = bb.column1 and bb.column2 = 'string' and a.column2 = bb.column3 where a.column3 = 'string' A couple of interesting things about this query. We're matching up 1 row in table a with 2 rows in table b by aliasing table b in two different ways. We're also using the "and" statement in our join, which is a neat trick.

Currently unrated


Recent Tweets

Recent Posts

Archive

2013
2012
2011
2010
2009
2008
2007
2006

Categories

Authors

Feeds

RSS / Atom