I know the question is strange, but I decided to ask.

Suppose I have a function in PHP:

function calculate(a); 

Takes the value of a as input, performs some calculations and returns the value of b . The value of a comes from the database, a certain table column. And the program needs to filter by the value of b .

Is it possible to do this without rewriting the same function in SQL and without loading all the rows from the table?

  • is impossible. Especially in php. if C would have thought of calling the function directly from the DBMS - Mike
  • Maybe. But with wild perversions. Write a UDF that will jerk the PHP script and parse the returned value. In general, you should not do so - Anton Shchyrov
  • PS A DBMS MS SQL or MySQL? - Anton Shchyrov
  • DBMS - MS SQL .. - Undefined
  • Easier to write the same function in SQL? - Undefined

1 answer 1

Put in the condition

 where b = calculate(a)