Using the parameter's value in the same query multiple times
Posted: Thu  07 May 2015 09:27
				
				Hi there,
Is it possible to execute/open a query which needs one parameter that gets used multiple times?
e.g:
If I open this query, only the first parameter gets the value when I do:
MyQuery.ParamByName('Par1').AsString:= 'Value';
The second parameter is Null or not provided.
I know I can work around by making them two different params which hold the exact same value (:Par1&:Par2), or using MySQL variables.
But I need to know if it's possible to reuse that only one parameter, multiple times just by passing one line value and all occurrence of the parameter in the query gets evaluated to that value.
i.e:
MyQuery.ParamByName('Par1').AsString:= 'Value';
To make the query like:
Regards,
			Is it possible to execute/open a query which needs one parameter that gets used multiple times?
e.g:
Code: Select all
select * from Table
where ColA = :Par1
and ColB = :Par1MyQuery.ParamByName('Par1').AsString:= 'Value';
The second parameter is Null or not provided.
I know I can work around by making them two different params which hold the exact same value (:Par1&:Par2), or using MySQL variables.
But I need to know if it's possible to reuse that only one parameter, multiple times just by passing one line value and all occurrence of the parameter in the query gets evaluated to that value.
i.e:
Code: Select all
select * from Table
where ColA = :Par1
and ColB = :Par1To make the query like:
Code: Select all
select * from Table
where ColA = 'Value'
and ColB = 'Value'