I have two tables.One of them is used only in run time( like temporary table). While I 'm passing from page to another, I'm using two table.
Temporary table have fields:
stok_no miktar dusulen_id
Real Table have fields;
id stok_no kalan
we assume that user inserted some data
Real table
Expand|Select|Wrap|Line Numbers
- id stok_no kalan
- 393 1375 10
- 394 1375 8
Expand|Select|Wrap|Line Numbers
- stok_no miktar dusulen_id
- 1375 3 393
- 1375 4 393
Expand|Select|Wrap|Line Numbers
- id stok_no kalan miktar toplam fark
- 393 1375 10 6 4
- 394 1375 8 0 8
Expand|Select|Wrap|Line Numbers
- SELECT (D.kalan-G.miktari) kalan
- FROM ayniyat_fis_detay D,
- (SELECT dusulen_id, SUM(miktari) as miktari
- FROM ayniyat_fis_detay_gecici
- GROUP BY dusulen_id) G
- where D.id= G.dusulen_id