Cleanup building of sql
Add alias on TableInfo
Support self referencing joins to one level