tsql - Creating a view with a column not in the base table -
i have table 4 columns. being asked create view performs calculation , puts results in column not in table.
here is: create view called v_count shows number of students working on each assignment. view should have columns assignment number , count.
the underlying table not have count column.
well have make use of count
function , group by
clause. suppose have student id , assignment id in table:
sid asnid 1 1 1 2 2 1 2 5 2 8 3 2 3 4
then following query give count of students working on assignments:
select asnid [assignment], count(sid) [students] assignment group asnid
now can use query create view. read docs count
, group by
Comments
Post a Comment