You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One more crazy idea to extend SQL: I am thinking about two different operators: LET and BEGIN (like in the question from StackOverflow).
LET will work before WHERE (wherefn()) and BEGIN will work right before or right after SELECT(selectfn()/groupfn()) like:
SET @c =0;
SELECT a, @b, @c
FROM one
LET @b = a*a // internal variable only for current lineWHERE @b >10BEGINSET @c = @c + a END; // own accumulator for selected lines
or call external procedure for each selected line:
alasql.fn.myfn = function (r) {
alasql.vars.b = r.default.a*r.default.a
};
alasql('SELECT a, @b FROM one LET myfn() WHERE @b > 10 ');
Like:
Source
This cluse will be calculated right before
wherefn()andselectfn()( orgroupfn()).