You are here: trying to group by two diff criteria « MsSQL Server « IT news, forums, messages
trying to group by two diff criteria

Posted by dn.perl@gmail.com on 02/16/07 08:10

I have a table t1 with two columns : c11 varchar(32) , c22 varchar(32)

The data in the table is :
'11', 'aa01'
and on upto
'11', 'aa50' : total 50 entries
'22', 'b01'
'22', b'02'
'22', b'03'
'33', 'c01' to '33', 'c40' : total 40 entries
'44', 'b02'
'44', 'd01'
'44', 'd01'
'44', 'd01'


How can write a query which will bunch together values of c11
with rows > 5, and then bunch together values of c11 with
rows < 6, and add them up.
My output should be :
'11' 50
'33' 40
'others' 7 (3 rows for '22' and 4 for '44' are bunched
together
as the # of rows < 6, and added. 3+4 = 7)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация