How to return multiple results using sql delegate [SOLVED]
Archived from the Xataface Users forum.
cantlep — Thu Mar 18, 2010 7:34 am
Hi,
As per this link - http://xataface.com/wiki/sql_delegate_method I can create a function that uses __sql__ for table grafting. All works fine. However, I want to do it to 2 columns. I know I can’t return more than once, but if I just create anotehr function __sql__ entry, it errors.
How can I have both columns grafted. i.e.
- Code: Select all
- `function sql(){
return “select c.*, s.TotalSites from Customers c left join CustomerStats s on c.CompanyName=s.CompanyName”;
}function sql(){
return “select c.*, s.TotalContracts from Customers c left join ContractStats s on c.CompanyName=s.CompanyName”;
}`
type of thing.
Cheers
cantlep — Thu Mar 18, 2010 8:48 am
Sorry, I keep posting and then figuring out the answer. This worked
- Code: Select all
function __sql__(){ return "select c.*, s.TotalSites,r.TotalContracts from Customers c left join CustomerStats s on c.CompanyName=s.CompanyName left join ContractStats r on c.Companyname=r.CompanyName"; }
Cheers