db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ron piterman <ron.piter...@gmx.net>
Subject Re: Exclusive Criteria OR Conditions
Date Wed, 21 Jul 2004 09:00:06 GMT
I don't have much expreince with Torque, but did you think of:

function Criterion or(List rules) {
	List temp = new Vector();
	for (int i = 0; i < rules.size(); i++) {
		
		Criterion c = createCriterion(rules.get(i));
		if (i > 0)
			((Criterion)temp.get(i-1)).or(c);
		temp.add(c);
	}
	return (Criterion)temp.get(0);
}

now the createCriterion method is missing, but one can figure...

Cheers,
Ron


Michael.Kashambuzi@bmwna.com wrote:
> I've already checked in the mailing list and have not found an answer.
> 
> Does anyone know how to perform an OR in the following situation.
> 
> 	SELECT A, B, C
> 	FROM TABLE1
> 	WHERE A IN (1,2,3) OR B IN (4,5,6) OR D in (7,8,9)
> 
> For each criterion, I want to add it as a criterion to the main Criteria
> object and not as a criterion for a preexisting criterion.
> 
> 	Criterion1: A IN (1,2,3) 
> 	Criterion2: B IN (4,5,6) 
> 	Criterion3: D in (7,8,9)
> 
> I want to add each of the above criterion to the Criteria ndependently.  I
> don't want to add Criterion3 and as an OR to Critrion2 and the Criterion2 as
> an OR to Criterion1.
> 
> Most of my queries are dynamic in nature so I can't always assume the order
> in which criteria are added.  I just need to provide n Criterion objects and
> all all n independently as OR's to my main Criteria object.
> 
> Any ideas?
> 
> Thanks.
> 
> Michael



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message