How to return multiple results using sql delegate [SOLVED]

A place for users and developers of the Xataface to discuss and receive support.

How to return multiple results using sql delegate [SOLVED]

Postby 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
Last edited by cantlep on Thu Mar 18, 2010 8:49 am, edited 1 time in total.
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am

Re: How to return more than one result using sql delegate class

Postby 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
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 28 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved