Filter on TZQuery

Forum related to version 6.1.5 of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 12.09.2006, 18:05

Filter on TZQuery

Postby bedfordch » 27.08.2007, 09:09

I've version 6.1.5, Delphi 6 enterprise and Mysql database.
In a TZQuery I've this SQL:

select id, sum(amount1) as total1, sum(amount2) as total2,
sum(amount3) as total3, sum(amount1+amount2+amount3) as total
from orders
group by id

Now I'm trying to apply a filter on a field in this query:
ordertype < 12
Problem: it doesn't seem to work. With or without filter, the result is the same. I've tried to apply ordertype < 1 to reduce the number of records but the result is always the same. What's wrong ? filter doesn't work on totals ?
Thanks for helping, it's 2 day I'm on this problem.

ZeosLib's Handyman :o)
ZeosLib's Handyman :o)
Posts: 189
Joined: 15.08.2005, 16:08
Location: Wehrheim

Postby Michael » 27.08.2007, 11:40

erm ... where is the "ordertype" in your query :gruebel:

If you want to reduce the records to be summed up you have to include a where clause in your statement. otherwise you have to include "ordertype" in your select and group by statement.
:prog2: Use the source, dude!

[align=right]..::.. ZeosLib on SourceForge ..::..[/align]

Return to “6.1.5”

Who is online

Users browsing this forum: No registered users and 1 guest