[thelist] SQL - Group by peculiarity in Sybase

Matt Warden mwarden at gmail.com
Thu Apr 14 12:48:06 CDT 2005


Volkan,

On 4/14/05, VOLKAN ÖZÇELİK <volkan.ozcelik at gmail.com> wrote:
> SELECT taktar,taktut, "sum(taktut)" as toplam FROM p_taksit
> WHERE (necessary filters)
> 
> which returns a single row.:
> 
> Apr 14 2005 12:00 AM    -  95.38        -  "sum(taktut)"
> 
> When I alter the query to:
> 
> SELECT taktar,taktut, sum(taktut) as toplam FROM p_taksit
> WHERE (necessary filters)
...
> I get around 32000+ rows (the entire table), the returned
> result is not filtered by (necessary filters) as well.

What are you doing in "(necessary filters)"? The only thing that comes
to mind is that if you are doing some kind of result limiting (like
MySQL's LIMIT clause), then the database might be incorrectly using
the table's stored sum in the system catelog. But, if you're offering
it a date range in the WHERE clause, etc., it shouldn't be using that
stored value.

Still, aside from serious deviation in Sybase from SQl standard, I
don't see us being able to help without seeing the WHERE clause.

-- 
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.


More information about the thelist mailing list