Hello listers,
=20
Our customer has the following question about SQL syntax in the MapInfo =
Professional:
I have two tables (see example bellow) and I want aggregate one value =
and after aggregation this value subtract it from another value.
=20
Example:
1. Table CAPACITY
Type       Capacity
1                     100
2                     200
3                     300
=20
2. Table WATER_INLET
Type       Quantity
1                1
1                5
1                8
2                2
1                1
1                6
3                7
3                5
=20
I need get this result:
Type       Capacity                SUM(Quantity)                =
Difference =3D Capacity-SUM(Quantity)
1              100                          21                           =
                 79
2              200                          2                            =
                  198
3              300                          12                           =
                 288

(Some programs allows do that for example this way  :
SELECT CAPACITY.Type, CAPACITY.Capacity, SUM(WATER_INLET.Quantity) AS =
SumQuantity, CAPACITY.Capacity - SUM(WATER_INLET.Quantity) AS Difference =
FROM CAPACITY, WATER_INLET WHERE CAPACITY.Type=3DWATER_INLET.Type GROUP =
BY WATER_INLET.Type )
=20
The question: is it possible do this in one SELECT at the MapInfo? I =
can't write Capacity-SUM(Quantity) as a select column

Thanks.

Roman Baca
=20
[EMAIL PROTECTED]
=20



_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to