Thanks to everyone for the help. I coded up a user defined function and WHERE 
... AND security() = 1 works great.
 
Thanks again - Roland Martin

-----Original Message-----
From: Hick Gunter [mailto:h...@scigames.at] 
Sent: Friday, December 19, 2014 7:39 AM
To: 'General Discussion of SQLite Database'
Subject: Re: [sqlite] Row filtering prior to aggregate function execution

NO.

WHERE constraints are applied on the input set (i.e. the rows which evaluate to 
security() = FALSE are excluded from the aggregation)

HAVING constraints are applied on the output set (which is too late, and with 
"randomly chosen"* values)

* For a non-aggregated and ungrouped field, the value returned will be from a 
"randomly chosen" record. If there is a single MIN or MAX aggregate, from a 
"randomly chosen" record whose field value for the MIN or MAX field matches 
that value.

-----Ursprüngliche Nachricht-----
Von: Staffan Tylen [mailto:staffan.ty...@gmail.com]
Gesendet: Freitag, 19. Dezember 2014 11:28
An: General Discussion of SQLite Database
Betreff: Re: [sqlite] Row filtering prior to aggregate function execution

Would this work?

SELECT SUM(...),COUNT(...), ... FROM ...
WHERE ...
GROUP BY ...
HAVING security(...)
...

Staffan



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to