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.
Author |
Topic |
niyaz4872
Starting Member
41 Posts |
Posted - 2011-10-17 : 06:03:50
|
following is my table structure SuitDtl_KALA_ID,Suit_Id,SuitDtl_Qty,SuitDtl_Qty_jayeze1513215191 151390000297 1.000 0.0001513215192 151390000297 3.000 0.0001513215193 151390000297 1.000 0.0001513207151 151390000297 2.000 0.0001513207152 151390000297 3.000 0.0001513207153 151390000297 1.000 0.0001513217103 151390000297 5.000 0.0001513215193 151390000297 0.000 1.0001513207151 151390000297 0.000 1.0001513217103 151390000297 0.000 1.000following is sample results i wan't SuitDtl_KALA_ID,Suit_Id,SuitDtl_Qty,SuitDtl_Qty_jayeze151390000297 1513207151 2.000 1.000151390000297 1513207152 3.000 0151390000297 1513207153 1.000 0151390000297 1513215191 1.000 0151390000297 1513215192 3.000 0151390000297 1513215193 1.000 1.000151390000297 1513217103 5.000 1.000 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-17 : 08:01:39
|
can you tell me rule based on which you think you will get the above result?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
niyaz4872
Starting Member
41 Posts |
Posted - 2011-10-17 : 08:29:31
|
following is my table structureSuitDtl_KALA_ID,Suit_Id,SuitDtl_Qty,SuitDtl_Qty_jayeze1513207151 151390000297 2.000 0.0001513207151 151390000297 0.000 1.0001513217103 151390000298 0.000 2.0001513217103 151390000298 7.000 0.000following is sample results i wan'tSuitDtl_KALA_ID,Suit_Id,SuitDtl_Qty,SuitDtl_Qty_jayeze151390000297 1513207151 2.000 1.000151390000298 1513217103 7.000 2.000i want to merge these two rows with this rule ,if these(SuitDtl_KALA_ID,Suit_Id) filed value has same data make result it as a one row and sum these (SuitDtl_Qty,SuitDtl_Qty_jayeze) |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-17 : 08:33:31
|
[code]SELECT SuitDtl_KALA_ID,Suit_Id,SUM(SuitDtl_Qty) AS SuitDtl_Qty,SUM(SuitDtl_Qty_jayeze) AS SuitDtl_Qty_jayezeFROM tableGROUP BY SuitDtl_KALA_ID,Suit_Id[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
niyaz4872
Starting Member
41 Posts |
Posted - 2011-10-17 : 08:54:37
|
tnx |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-17 : 09:01:49
|
wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|