HI,
I have a function that is used to constrain a query:
Select COl1, Col2
From MyTable
WHERE col1 = ...
AND col2 = ...
And MyFunction(col1 ) = ...
My problem is that MyFunction is executed as many times that there are
rows in MyTable. I would like that it is being eecuted only when the
MyTable data has been filtered by two previous where conditions. This
way, MyFunction would be executed minimal times. So I did this:
Select a.*
From (Select COl1, Col2
From MyTable
WHERE col1 = ...
AND col2 = ...)
Where MyFunction(a.co l1) =...
With no success. MyFunction is executed as many times as there are
rows into MyTable.
Is There a way to ensure that a function is being executed at the end
of the where clause, when the data is filtered by previous conditions
as much as possible?
Thank you for your help,
Christian
I have a function that is used to constrain a query:
Select COl1, Col2
From MyTable
WHERE col1 = ...
AND col2 = ...
And MyFunction(col1 ) = ...
My problem is that MyFunction is executed as many times that there are
rows in MyTable. I would like that it is being eecuted only when the
MyTable data has been filtered by two previous where conditions. This
way, MyFunction would be executed minimal times. So I did this:
Select a.*
From (Select COl1, Col2
From MyTable
WHERE col1 = ...
AND col2 = ...)
Where MyFunction(a.co l1) =...
With no success. MyFunction is executed as many times as there are
rows into MyTable.
Is There a way to ensure that a function is being executed at the end
of the where clause, when the data is filtered by previous conditions
as much as possible?
Thank you for your help,
Christian
Comment