Added support for three table selects.