Subject | Re: [firebird-support] Re: SQL Problem |
---|---|
Author | Arno Brinkman |
Post date | 2004-11-09T14:35:13Z |
Hi,
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 ...
or you should not use JOIN, but a sub-query.
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep :
news://newsgroups.firebirdsql.info
> >> I ' ve a sql problem and want to resolve it with Firebird 1.5.1.Then MIN or MAX is probably enough ?
> >> 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.
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 ...
or you should not use JOIN, but a sub-query.
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep :
news://newsgroups.firebirdsql.info