|
From: ML on 18 Jul 2008 06:06 Are you planning to store this number in the table? Why? You don't need to store any aggregate data in the base tables. You can use a view instead: create view <view name> as select Name ,count(distinct Region) as NumberOfRegions from <table name> go Or is it something else you actually need? A more detailed description of the business requirements would help. ML --- Matija Lah, SQL Server MVP http://milambda.blogspot.com/
From: ML on 18 Jul 2008 06:42 Sorry, forgot a vital part: create view <view name> as select Name ,count(distinct Region) as NumberOfRegions from <table name> group by Name go ML --- Matija Lah, SQL Server MVP http://milambda.blogspot.com/
|
Pages: 1 Prev: Count ussing a column in the same table Next: How important are dependencies? |