[turba] SQL data from two tables

Manilal K M libregeek at gmail.com
Thu Jun 15 01:11:35 PDT 2006


On 15/06/06, Jan Schneider <jan at horde.org> wrote:
> Zitat von Manilal K M <libregeek at gmail.com>:
>
> > Hello all,
> >   I have installed and configured turba as my core address book. Now
> > I need to integrate turba with vtiger(CRM) contacts/leads.
> >   I have two tables and everything worked fine as described below.
> > http://marc.theaimsgroup.com/?l=turba&m=113147578002847&w=2
> >   But I need to include a condition for selecting the rows from the
> > two tables. Basically my query is something like this:
> >
> > SELECT leadid, leaddetails.firstname, leaddetails.lastname,
> > leaddetails.email, leadaddress.mobile, leadaddress.phone FROM
> > leaddetails LEFT JOIN leadaddress ON
> > leaddetails.leadid=leadaddress.leadaddressid WHERE
> > leaddetails.converted=0;
> >
> > But since there is a WHERE clause which is automatically appended to
> > the query I can't use like this:
> > 'table' => 'leaddetails LEFT JOIN leadaddress ON
> > leaddetails.leadid=leadaddress.leadaddressid WHERE
> > leaddetails.converted=0 ',
> >
> > Is there any option to include a custom WHERE clause in sources.php?
>
> Yes, the (undocumented) 'filter' setting.
>
> Jan.
>

Hello  Jan & Chuck,
   The filter setting worked for me. Now the params array in
sources.php looks like this:
'params' => array(
         'phptype' => 'mysql',
         'hostspec' => 'localhost',
         'username' => 'uuuuuu',
         'password' => '********',
         'database' => 'dbdbdb',
         'table' => 'leaddetails LEFT JOIN leadaddress ON
leaddetails.leadid=leadaddress.leadaddressid',
         'filter' => 'leaddetails.converted=0',
         'charset' => 'iso-8859-1'
    ),
thanks & regards
Manilal


More information about the turba mailing list