Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Query

Author  Topic 

itsrahulk
Starting Member

2 Posts

Posted - 2010-08-05 : 03:36:03
hi my table is in foem


md zone status Amount

abc comm ALL Success 230
abc comm ALL Failed 200
ashish comm KNP Failed 100


i need sum of status by md and zone name like

zone md succes failed

ALL abc comm 230 200
KNP ashish comm 100 100


in this way

please help me what sql query would be for this.


Thanks




Sachin.Nand

2937 Posts

Posted - 2010-08-05 : 04:24:15
Why should success and failed come 100 for this record?
 KNP ashish comm 100 100



Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

jcelko
Esteemed SQL Purist

547 Posts

Posted - 2010-08-06 : 13:30:04
quote:
Originally posted by itsrahulk

hi my table is in foem


md zone status Amount

abc comm ALL Success 230
abc comm ALL Failed 200
ashish comm KNP Failed 100


i need sum of status by md and zone name like

zone md succes failed

ALL abc comm 230 200
KNP ashish comm 100 100


in this way

please help me what sql query would be for this.


Thanks








--CELKO--
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
Go to Top of Page
   

- Advertisement -