`declare @totalItems int,
@totalPeople int,
@averageThings float;
select @totalItems = count(*) from table1
select @totalpeople = count(*) from tblvisits
select @averageThings = cast(@totalItems/@totalPeople as float)
select @averageThings, @totaPeople, @totalItems
これは float の代わりに整数を返しますcast as float
。