need help on updating a table
hi,
i need on updating table data....i want find out records below table , combine them one. example need combine first 2 records 1 , other 2 records single record. year columns have either null or data want combine such records 1 record instead of having 2 records.
table test
division div_cd market group year06 year 07 year08
california ca income donors null 230 null
california ca income donors null 0 45
eastern ea affiinity captain null null 10
eastern ea affiinity captain null 540 null
select division, div_cd, market, [group], max(year06) as year06, max(year07) as year07, max(year08) as year08 from datatable group by division, div_cd, market, [group]
premature optimization root of evil in programming. (c) donald knuth
naomi nosonovsky, sr. programmer-analyst
my blog
SQL Server > Transact-SQL
Comments
Post a Comment