[Zope] Help! SQL String
Anthony Baxter
Anthony Baxter <anthony@interlink.com.au>
Wed, 06 Oct 1999 00:32:43 +1000
>>> "Joshi, Sunit" wrote
> I'm using an SQL query which fetches data from two tables like:
> select ta.Name, tb.DeptNo, tb.Title, tb.Salary
> from tblFacts ta, tblEmployee tb
> where ta.EmployeeID = tb.EmployeeID
> order by DeptNo
>
> Now when I use the query in a DTML doc. how do I reference the
> columns, will it be like ta.Name, tb.DeptNo
> or will it be Name & DeptNo
"it depends" on the SQL engine.
A better solution would be to spell your query:
select ta.Name as Name, tb.DeptNo as DeptNo,
tb.Title as Title, tb.Salary as Salary
from tblFacts ta, tblEmployee tb
where ta.EmployeeID = tb.EmployeeID
order by DeptNo
This forces the column names to be what you want them to be.
Anthony