🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11358

Re: SQL - Calc.Field

#11358
From: Harun Bolat
Date: Sun, 24 Nov 2002 12:41
45 lines
2116 bytes
try

SELECT SUM((TRQTY + BUYQTY - SELLQTY) * COSTPRICE),P.PARTNO
FROM PARTS P
JOIN DETAIL D ON D.PARTNO = P.PARTNO
GROUP BY P.PARTNO

"Henry Olive" <zed@zedltd.com> wrote in message
news:3ddfcb72@newsgroups.borland.com...
> IB6, D6
>
> Detail Table : Trs Means ( Transfer from last year )
> PK=Recnum,LineNum
>
> PARTNO    TRSQty   BUYQty   SELLQty
> --------------------------------------------
> AAA            2                0               0
> BBB             0                2               0
> AAA            0                0               1
>
>
> Part Table :  PK=PartNo
> PARTNO        COSTPRICE
> ------------------------------
> AAA                   100.00
> BBB                    250.00
>
> I need Current Inventory Value.
> InvValue:=600.00.-
> ( which is ,  1 * AAA (100.00)   +  2 * BBB( 250.00) )
>
> Something like below.
> SELECT SUM(D.TRSQty + D.BUYOty - D.SELLQty)*P.COSTPRICE
> FROM DETAIL D, PARTS P
> WHERE(P.PARTNO = D.PARTNO)
>
> Thank you.
>
>
>
>
>
>
>
>
Technical Details
Message-ID: <3de0c8e2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3ddfcb72@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,efe094e56bbe5a1b
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-11-24 05:17:48 PST
Reply-To: "Harun Bolat" <harunbolat@kaynet.net>
From: "Harun Bolat" <harunbolat@kaynet.net>
Newsgroups: borland.public.interbase.sql
References: <3ddfcb72@newsgroups.borland.com>
Subject: Re: SQL - Calc.Field
Date: Sun, 24 Nov 2002 14:41:28 +0200
Lines: 47
Organization: Ak yaz�l�m
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 212.174.243.150
Message-ID: <3de0c8e2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1038141666 212.174.243.150 (24 Nov 2002 04:41:06 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail