ServiceStack/ServiceStack.OrmLite — pull request #324 by madaleno (2013-10-01 10:22:21+00:00)
Title: Fixed JoinSqlBuilder to include table name

The JoinSqlBuilder.ToSql() wasn't prepending field names with the corresponding table name in the field list.
When using joins this is a must to avoid field name conflicts between tables.

Before, this was the generated sql:
```sql
SELECT Address,BirthDate,City,Country,Extension,FirstName,HireDate,HomePhone,EmployeeID,LastName,Notes,Photo,PhotoPath,PostalCode,Region,ReportsTo,Title,TitleOfCourtesy
FROM EmployeeTerritories
INNER JOIN Employees ON Employees.EmployeeID = EmployeeTerritories.EmployeeID
LEFT OUTER JOIN Territories ON EmployeeTerritories.TerritoryID = Territories.TerritoryID
WHERE (Territories.TerritoryDescription = 'Boston')
```
gives this error in FireBird:
>Ambiguous field name between table EMPLOYEETERRITORIES and table EMPLOYEES .
>EMPLOYEEID.

now it generates this sql with no errors:
```sql
SELECT Employees.Address,Employees.BirthDate,Employees.City,Employees.Country,Employees.Extension,Employees.FirstName,Employees.HireDate,Employees.HomePhone,Employees.EmployeeID,Employees.LastName,Employees.Notes,Employees.Photo,Employees.PhotoPath,Employees.PostalCode,Employees.Region,Employees.ReportsTo,Employees.Title,Employees.TitleOfCourtesy
FROM EmployeeTerritories
INNER JOIN Employees ON Employees.EmployeeID = EmployeeTerritories.EmployeeID
LEFT OUTER JOIN Territories ON EmployeeTerritories.TerritoryID = Territories.TerritoryID
WHERE (Territories.TerritoryDescription = 'Boston')
```