I design a new application.
I use sQL server. So i have a prolem.
I want table tbStock caculate, in column tbStock.quality = tbImport.quality - tbExport.quality
but they have to follow field batch.
And this is my code. Not working
create proc [dbo].[sp_XuatLayBatch]
@Ma as nchar(14)
as
select sum(tbImport .SoLuong)as SLN,sum(tbExport .SoLuong)as SLX,tbImport .Batch from tbImport, tbExport
where tbImport .Ma = @Ma and (tbExport.Ma=tbImport .Ma or tbExport.Ma is null)
group by tbImport .Batch
[Link Text]http://www.mediafire.com/view/l5fyiaa8flolgda/Batch_tong_2.JPG
Please help me.
I use sQL server. So i have a prolem.
I want table tbStock caculate, in column tbStock.quality = tbImport.quality - tbExport.quality
but they have to follow field batch.
And this is my code. Not working
create proc [dbo].[sp_XuatLayBatch]
@Ma as nchar(14)
as
select sum(tbImport .SoLuong)as SLN,sum(tbExport .SoLuong)as SLX,tbImport .Batch from tbImport, tbExport
where tbImport .Ma = @Ma and (tbExport.Ma=tbImport .Ma or tbExport.Ma is null)
group by tbImport .Batch
[Link Text]http://www.mediafire.com/view/l5fyiaa8flolgda/Batch_tong_2.JPG
Please help me.
Last edited: