/* Phạm Thị Ly cntt k1c */
/* bai4-cau2 */
alter table detai
add soluong float
declare contro cursor
for select msdt,tendt,soluong from detai
open contro
declare @soluong float
declare @msdt char(6)
declare @tendt nchar(30)
fetch next from contro into @msdt,@tendt,@soluong
while @@fetch_status=0
begin
select @soluong=count(mssv)
from sv_detai,detai
where sv_detai.msdt=detai.msdt
and detai.msdt=@msdt
print N'mã số đề tài:' +@msdt +' ' + N'tên đề tài:' +@tendt + ' '+ N'số lượng:' + convert(varchar(5),@soluong)
fetch next from contro into @msdt,@tendt,@soluong
end
close contro
deallocate contro