[AccessD] Complex query....for me :-)

Gustav Brock Gustav at cactus.dk
Wed Mar 2 04:23:25 CST 2005


Hi Sander

That could be:

  SELECT
    SUM(ABS(CATEGORY='NP')*POSITION) AS [New Pos],
    SUM(ABS(CATEGORY='NZ')*POSITION) AS [Old Pos],
    SUM(ABS(CATEGORY='DD')*POSITION) AS [Delivered]
  FROM
    tblYourTable;

/gustav

>>> accessd666 at yahoo.com 02-03-2005 08:35:24 >>>
Hi group,

I've got a table with a field called [category] and a
field called [position].

I need a query that has several output fields:
New Pos, Old Pos, Delivered

The calculation for these fields is as follows:
New Pos = SUM(POSITION) WHERE CATEGORY = "NP"
Old Pos = SUM(POSITION) WHERE CATEGORY = "NZ"
Delivered = SUM(POSITION) WHERE CATEGORY = "DD"

But how do I create a query that spits out these
values??

Thnx.

Sander



More information about the AccessD mailing list