Hi,
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
[code=text]
id stok_no kalan
393 1375 10
394 1375 8
[/code]
Temporary table
[code=text]
stok_no miktar dusulen_id
1375 3 393
1375 4 393
[/code]
Finally I want to show this
[code=text]
id stok_no kalan miktar toplam fark
393 1375 10 6 4
394 1375 8 0 8
[/code]
I have sql statement but it doesn't work as I want
[CODE=sql]SELECT (D.kalan-G.miktari) kalan
FROM ayniyat_fis_det ay D,
(SELECT dusulen_id, SUM(miktari) as miktari
FROM ayniyat_fis_det ay_gecici
GROUP BY dusulen_id) G
where D.id= G.dusulen_id[/code]
It works only id=393 because temporary table has it.
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
[code=text]
id stok_no kalan
393 1375 10
394 1375 8
[/code]
Temporary table
[code=text]
stok_no miktar dusulen_id
1375 3 393
1375 4 393
[/code]
Finally I want to show this
[code=text]
id stok_no kalan miktar toplam fark
393 1375 10 6 4
394 1375 8 0 8
[/code]
I have sql statement but it doesn't work as I want
[CODE=sql]SELECT (D.kalan-G.miktari) kalan
FROM ayniyat_fis_det ay D,
(SELECT dusulen_id, SUM(miktari) as miktari
FROM ayniyat_fis_det ay_gecici
GROUP BY dusulen_id) G
where D.id= G.dusulen_id[/code]
It works only id=393 because temporary table has it.
Comment