Michael L. Hostbaek wrote:
>Now, I need the first line to say "15.00" in the cmup field. That is,
>stock and incoming are obviously not being grouped, but since it's the
>same partno I'd like somehow to show the highest cmup. Is there some
>black SQL voodoo that'll achieve this ?

I think you need to join the table back on itself to get the total
for each part.  Not a very impressive incantation, but I'd do it 
in SQL like this:

  SELECT x.partno, x.status, y.tot, sum(x.qty)
  FROM my_table x, (
    SELECT partno, MAX(cmup) as tot
    FROM my_table
    GROUP BY partno) y
  WHERE x.partno = y.partno
  GROUP BY x.partno, x.status, y.tot

Cheers,
  Sam

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to