--- Mina R Waheeb <[EMAIL PROTECTED]> wrote:
>   I have some questions about the behavior of aggregate functions and
> the result LIMIT.
> After register TEST function and executing query (SELECT TEST() FROM
> objects group by id LIMIT 30,3)
> 
> I was expect calling back TEST() only 3 times but what happened is the
> TEST() is called 33 time, and the result set is correct 3 rows.

Test() would (and should) be called for each row in the 
table "objects". How else could it aggregate the information?

> My questions:
> - Why TEST() is called for non-result rows? Is this designed  feature?

Regarding non-results rows - you only know that after the fact that it's
a non result row - after all rows are processed. Do the query yourself 
manually on paper and see.

> - When the evaluation of the result-column functions happen?
> - How SQLite preform the LIMIT?

Logically, it operates on the result set after the GROUP BY.
In code, it is more involved than that.

Also keep in mind that you're assuming that GROUP BY does an ordering
on "id". In SQLite it happens to be the case because of its use
of btrees, but this is not guaranteed on other databases where they
may use a hash map for group by. You need an explicit "ORDER BY id" 
to guarantee an order.


       
____________________________________________________________________________________
Got a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
 

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to