🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

need advice about sql for data mining

#146
From: Isaac
Date: Mon, 09 Jun 2008 23:02
30 lines
1882 bytes
Hello,
I am looking for a logical and fast way to make the following

I have 5 tables:
1- inventory items (item code, name, etc...)

2- purchased invoices (date, invoice no, etc...)
3- detail table for table purchased invoices to store invoices items 
(item code, quantity, price, etc...)

4- sold invoices (date, invoice no, etc...)
5- detail table for table sold invoices to store invoices items (item 
code, quantity, price, etc...)

now I need to store all the items from table 1 into the following table 
ordered by date so I can calculate average cost

6- table average cost:

Date        purchased qty           cost price            sold qty
-----       --------------            ----------            ---------
5/6          50                             40.5                    0
7/6            40                           42                       
23      and so on

I am thinking to for using insert into with select expression for table 
2 and 3 but I need to also insert quantity sold for the same date how I 
can do that ?, again speed is critical

Thanks
Technical Details
Message-ID: <484db5e2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,b4be59b23378bfae,start
X-Google-Attributes: gid114a0e,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 10 Jun 2008 02:02:46 +0300
From: Isaac <no@no.com>
User-Agent: Thunderbird 2.0.0.14 (Windows/20080421)
MIME-Version: 1.0
Newsgroups: borland.public.interbase.sql
Subject: need advice about sql for data mining 
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 41.234.199.16
Message-ID: <484db5e2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1213052386 41.234.199.16 (9 Jun 2008 15:59:46 -0700)
Lines: 30
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail