Filtering A MySQL Result Set Based On The Return Value Of A Function
Posted
by Joshua
on Stack Overflow
See other posts from Stack Overflow
or by Joshua
Published on 2010-03-22T12:44:41Z
Indexed on
2010/03/22
12:51 UTC
Read the original article
Hit count: 352
mysql
|stored-procedures
I'm a SQL noob, and I need a little bit of help understanding the big picture of if it is possible, and if so how to go about filtering a result set based on the return value of a function which is passed one of the fields of the record.
Let's say I have a table called "Numbers" with just one field: "Value".
How could I correctly specify the following "pseudo-sql"?:
SELECT Value FROM numbers WHERE IsPrime(Value)=true
Can I accomplish such a thing, and if so, where/how do I put/store "IsPrime"?
I'm using MySQL.
© Stack Overflow or respective owner