Re: Query problem

From: JAMES <harleyip_at_hotmail.com>
Date: Thu, 7 Dec 2000 21:11:11 +0800
Message-ID: <90o286$saq23_at_imsp212.netvigator.com>


Another problem,
if more than one record for P001 in both stock_out and stock_in tables. How can I solve it?

Richard <richard.lange_at_profidatagroup.com> wrote in message news:90o1kh$fsl$1_at_pollux.ip-plus.net...
> SELECT stock_in.item_id, stock_in.qty - stock_out.qty
> FROM stock_in, stock_out
> WHERE stock_in.item_id = stock_out.item_id;
>
> (I think)
> Hope it helps
> richard
>
>
> "JAMES" <harleyip_at_hotmail.com> schrieb im Newsbeitrag
> news:90o10u$da12_at_imsp212.netvigator.com...
> > I have 3 tables, I want to show current stock quantity for each item.
> >
> > Table item
> > <item_id> <item_name> <cost>
> > <selling_price>
> > P001 A4 Paper 10
 12
> > P002 Pen 2
> > 3
> > P003 Eraser 1
 2
> > P004 Book 20
 25
> >
> > Table stock_out
> > <item_id> <qty> <date>
> > P001 4 11-NOV-00
> > P002 2 02-NOV-00
> >
> > Table stock_in
> > <item_id> <qty> <date>
> > P001 10 01-OCT-00
> > P002 10 01-AUG-00
> > P003 10 01-JUL-00
> > P004 10 01-AUG-00
> >
> >
> > How can I show the following result?
> > <item_id> <qty>
> > P001 6
> > P002 8
> > P003 10
> > P004 10
> >
> >
> > THANKS
> > James
> >
> >
>
>
Received on Thu Dec 07 2000 - 14:11:11 CET

Original text of this message