How to solve this Query?
CREATE TABLE tft
(
Id INT PRIMARY KEY IDENTITY(1,1),
Ename VARCHAR(20),
Etot DECIMAL(18,2),
ebaltot DECIMAL(18,2),
estat INT
)
INSERT INTO tft VALUES('AA1',100,10,1)
INSERT INTO tft VALUES('AA2',200,2500,2)
INSERT INTO tft VALUES('AA3',300,750,2)
INSERT INTO tft VALUES('AA4',480,0,1)
-- i tried here but not working this
SELECT * FROM tft
SELECT Id,Ename,SUM(Etot),SUM(ebaltot),estat FROM tft WHERE estat IN(1,2)
GROUP BY Id,Ename,Etot,ebaltot,estat
-- I need Myoutput like this
--Output - 1
Id EName Etot EbalTot estat
1 AA1,AA4 490 10 1
2 AA2,AA3 500 3250 2
--Output - 2
Id Etot EbalTot estat Id Etot EbalTot estat
1 490 10 1 2 500 3250 2
Mark as Answer if its helpful to you
Kumaraspcode2009@gmail.com