Would this work? SELECT SUM(...),COUNT(...), ... FROM ... WHERE ... GROUP BY ... HAVING security(...) ...
Staffan On Fri, Dec 19, 2014 at 7:47 AM, Hick Gunter <h...@scigames.at> wrote: > > SELECT ...,sum(...),count() FROM ... WHERE security(...) ... > > With a user defined function security(). > > -----Ursprüngliche Nachricht----- > Von: Roland Martin [mailto:rolandsmar...@gmail.com] > Gesendet: Donnerstag, 18. Dezember 2014 17:09 > An: sqlite-users@sqlite.org > Betreff: [sqlite] Row filtering prior to aggregate function execution > > I have a need to filter the result set before aggregate functions are > performed. For example, a query with a group by clause produces a result > set of 5 rows with count() and sum(). For each of the 5 rows I need the > value of a single column to serve as input into a security check. If the > security checks passes the row is part of the final result set. If the > security check fails the row is discarded and is not part of the final > result set. The final result set in the example could be 0-5 rows and I > would like the result values of count() and sum() to be accurate. > Unfortunately I cannot query the security system to find out all valid > values and add these values to the where clause. I have to give a value to > the security system and it returns pass or fail. > > > > Based on the above, is there a callback or other mechanism I can use to > participate in the result set generation? > > > > Thanks for the help - Roland Martin > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > ___________________________________________ > Gunter Hick > Software Engineer > Scientific Games International GmbH > FN 157284 a, HG Wien > Klitschgasse 2-4, A-1130 Vienna, Austria > Tel: +43 1 80100 0 > E-Mail: h...@scigames.at > > This communication (including any attachments) is intended for the use of > the intended recipient(s) only and may contain information that is > confidential, privileged or legally protected. Any unauthorized use or > dissemination of this communication is strictly prohibited. If you have > received this communication in error, please immediately notify the sender > by return e-mail message and delete all copies of the original > communication. Thank you for your cooperation. > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users