Welcome Guest, Not a member yet? Register   Sign In
possible to use table aliases when constructing a join?
#1

[eluser]sneakyimp[/eluser]
So I'm trying to construct a join and it looks like db->join doesn't support table aliasing, which is a hassle in my case because
a) my table names happen to be really long
b) i'm defining them in class constants

The latter point results in really awkward join syntax like this:
Code:
$db->join(self::DATABASE_TABLE, OtherClass::DATABASE_TABLE" . ".id=" . self::DATABASE_TABLE . ".id");

I mean it's not hugely awkward but I find it surprising that one must explicitly type the name of a database table in the join condition because this makes one's code break if the db table name gets changed. Also, why no table aliasing? Weird.





Theme © iAndrew 2016 - Forum software by © MyBB