Thanks Michiel
> You should use addStep only once. The second (and third and ..) time you
> must use addRelationStep.
unfortunately I tried that - the code I sent through had gone through many
variations,
the code:
BasicSearchQuery query = new BasicSearchQuery();
BasicStep step1 = query.addStep(templateFields);
FieldDefs field_name = templateFields.getField("field_name");
BasicStepField field1 = query.addField(step1, field_name);
// Add a related step - field taxonomy.
MMObjectBuilder taxonomy = mmbase.getBuilder("data_field_taxonomy");
BasicRelationStep step2 = query.addRelationStep(insrel, taxonomy);
step2.setDirectionality(RelationStep.DIRECTIONS_DESTINATION);
// Add a related step - banks.
MMObjectBuilder banks = mmbase.getBuilder("banks");
BasicRelationStep step4 = query.addRelationStep(insrel, banks);
step4.setDirectionality(RelationStep.DIRECTIONS_DESTINATION);
produces:
SELECT template_fields.field_name
FROM mm_template_fields template_fields,mm_insrel insrel,
mm_data_field_taxonomy data_field_taxonomy,mm_insrel insrel,
mm_banksbanks
WHERE (template_fields.number=insrel.snumber AND
data_field_taxonomy.number=insrel.dnumber) AND
(data_field_taxonomy.number=insrel.snumber AND
banks.number=insrel.dnumber)
notice the two "insrel"s in the FROM portion - that and the fact that I'm
only adding relations to the query concerns me that the joins are not
occurring in the right place.
Regards
Emile