While researching an unrelated topic, I noticed the use of LIMIT ALL in an example on the IBM Knowledge Center website for Netezza. I'm unclear about the benefits of specifying LIMIT ALL here, and I am seeking clarification of the explanation (quoted below) from IBM. When might I need to specify LIMIT ALL?
SELECT CASE WHEN rand = .1 THEN 'A' WHEN rand = .2 THEN 'B' ELSE 'C' END
FROM (SELECT random() rand FROM tblA LIMIT ALL) subset
From the IBM Knowledge Center:
"The LIMIT ALL in the subquery prevents it from being pulled up into the parent query, and the random() function is invoked only once for each row of tblA, and therefore the same random() result is tested in each WHEN clause."
BTW... My question is unrelated to the use of "random()" in IBM's example.
Thank you!