Subject | Re: [firebird-support] Re: SQL Problem |
---|---|

Author | Carsten SchÃ¤fer |

Post date | 2004-11-09T16:04:52Z |

Arno Brinkman wrote:

only one time for every id_apos).

mfg

Carsten

> Hi,this only gives me the lowest weight, not the sum of all weights (counted

>

>>>> I ' ve a sql problem and want to resolve it with Firebird 1.5.1.

>>>> Follwing select:

>>>> select count(distinct id_apos),count(distinct

>>>> f_id_auftrag),count(distinct

>>>> f_id_kunde),sum(f_weight),sum(f_quantity) FROM t_apos ...JOIN...

>>>> WHERE ...

>>>>

>>>> My problem is that i have some doubles in id_apos in the select

>>>> and i want to sum the weight of every apos only one time. Is this

>>>> possible with normal sql?

>>>

>> case is working (with slight another syntax),

>> but problem is that id_apos is the primary key of t_apos so this

>> will not work,i think.

>

> Then MIN or MAX is probably enough ?

>

> select

> Count(distinct id_apos),

> Count(distinct f_id_auftrag),

> Count(distinct f_id_kunde),

> Min(f_weight),

> Sum(f_quantity)

> FROM

> t_apos ...

> JOIN...

> WHERE ...

>

only one time for every id_apos).

mfg

Carsten