I have the following Tables:
CREATE TABLE #table1 (Batchnumber INT NOT NULL, BOXID TINYINT NOT NULL, ErrorID TINYINT NULL, Weight INT); CREATE TABLE #table2 (ErrorID TINYINT, Description VARCHAR(100)); INSERT INTO #table1(Batchnumber, BOXID, ErrorID, Weight) VALUES (12345, 1, NULL, 1000), (12345, 2, 1, 1000), (12345, 3, 2, 1000); INSERT INTO #table2 (ErrorID, Description) VALUES (1, 'Network Error'), (2, 'Keyboard to chair interface problem'), (3, 'Unknown Error');
I need to have the following in the temp table
TempTable Batchnumber | Weight | Remarks 12345 3000 Network Error, Keyboard to chair interface problem
So he needs only 1 row with the Batchnumber, the sum of the weight for all 3 records and 1 field with all the error codes explained
Can someone help me with this please?