Forums

Join rule and where statement in two DB Multirecord loader

Benvenuto 09 Jul, 2013
Hy,
I'm using two couple of linked DB Multirecord loader (i.e, for example, DB multirecord loader A (Incarico) linked to DB multirecord loader C (carica) and DB multirecord loader B (Anagrafica) linked to DB multirecord loader C (carica)) and in the DB multirecord loader C (carica) I'm using the where statement <<attivo=1>>.
It works!!!
But I also need to filter the DB multirecord loader A (incarico) on the "tipo_incarico" filed value, so I set the WHERE box to <<tipo_incarico like %'f%>>. AND IT FAILS!! No data

I really hope in your help, because I'm not sure to undertand how it works.
In the following the SQL statements generated:

1) SELECT `incarico`, `Carica`.`cf_id` AS `Carica.cf_id`, `Carica`.`cf_uid` AS `Carica.cf_uid`, `Carica`.`cf_created` AS `Carica.cf_created`, `Carica`.`cf_modified` AS `Carica.cf_modified`, `Carica`.`cf_created_by` AS `Carica.cf_created_by`, `Carica`.`cf_modified_by` AS `Carica.cf_modified_by`, `Carica`.`cf_ipaddress` AS `Carica.cf_ipaddress`, `Carica`.`cf_user_id` AS `Carica.cf_user_id`, `Carica`.`socio_id` AS `Carica.socio_id`, `Carica`.`carica` AS `Carica.carica`, `Carica`.`attivo` AS `Carica.attivo` FROM `jos_chronoforms_data_Incarichi` AS `Incarico` INNER JOIN `jos_chronoforms_data_AssegnazioneIncarico` AS `Carica` ON attivo=1 WHERE tipo_incarico like '%forum%'
2) SELECT `cognome`, `nome`, `Carica`.`cf_id` AS `Carica.cf_id`, `Carica`.`cf_uid` AS `Carica.cf_uid`, `Carica`.`cf_created` AS `Carica.cf_created`, `Carica`.`cf_modified` AS `Carica.cf_modified`, `Carica`.`cf_created_by` AS `Carica.cf_created_by`, `Carica`.`cf_modified_by` AS `Carica.cf_modified_by`, `Carica`.`cf_ipaddress` AS `Carica.cf_ipaddress`, `Carica`.`cf_user_id` AS `Carica.cf_user_id`, `Carica`.`socio_id` AS `Carica.socio_id`, `Carica`.`carica` AS `Carica.carica`, `Carica`.`attivo` AS `Carica.attivo` FROM `jos_chronoforms_data_Anagrafica_Nuovo` AS `Socio` INNER JOIN `jos_chronoforms_data_AssegnazioneIncarico` AS `Carica` WHERE attivo=1
3) SELECT `Carica`.*, `Socio`.`cognome` AS `Socio.cognome`, `Socio`.`nome` AS `Socio.nome`, `Incarico`.`incarico` AS `Incarico.incarico` FROM `jos_chronoforms_data_AssegnazioneIncarico` AS `Carica` INNER JOIN `jos_chronoforms_data_Anagrafica_Nuovo` AS `Socio` ON Socio.cf_id=Carica.socio_id INNER JOIN `jos_chronoforms_data_Incarichi` AS `Incarico` ON Incarico.incarico_id=Carica.carica ON tipo_incarico like '%forum%' WHERE attivo=1 LIMIT 0,50

What I supposed to be was that the INNER JOIN and the WHERE statement of the first SELECT should be

SELECT `incarico`, `Carica`.`cf_id` AS `Carica.cf_id`, `Carica`.`cf_uid` AS `Carica.cf_uid`, `Carica`.`cf_created` AS `Carica.cf_created`, `Carica`.`cf_modified` AS `Carica.cf_modified`, `Carica`.`cf_created_by` AS `Carica.cf_created_by`, `Carica`.`cf_modified_by` AS `Carica.cf_modified_by`, `Carica`.`cf_ipaddress` AS `Carica.cf_ipaddress`, `Carica`.`cf_user_id` AS `Carica.cf_user_id`, `Carica`.`socio_id` AS `Carica.socio_id`, `Carica`.`carica` AS `Carica.carica`, `Carica`.`attivo` AS `Carica.attivo` FROM `jos_chronoforms_data_Incarichi` AS `Incarico` INNER JOIN `jos_chronoforms_data_AssegnazioneIncarico` AS `Carica` WHERE tipo_incarico like '%forum%' AND attivo=1

Really thanks to you all
Vince
GreyHead 09 Jul, 2013
Hi Vince,

You can only use one WHERE box - the entry you need will be something like:
 XXX.`tipo_incarico` LIKE '%forum%' AND YYY.`attivo` = 1
where XXX and YYY are the Model IDs for these entries (I can't tell where they come from by looking at your post).

Bob
Benvenuto 09 Jul, 2013
Thank you.
I was using LOAD DATA = yes for all three DB multirecord loader. Now I leave it to yes only for the last one (DB multirecord loader C in the example,) and writing there the WHERE condition with all the filters, it works correctly.
Bye Vince
This topic is locked and no more replies can be posted.