SQL

SELECT Nr1%2 + Nr2%2 + Nr3%2 + Nr4%2 + Nr5%2 + Nr6%2 AS Odds, 6 - (Nr1%2 + Nr2%2 + Nr3%2 + Nr4%2 + Nr5%2 + Nr6%2) AS Evens INTO #Temp FROM MyTableYou can then elect what you need from that:

SQL

--DROP TABLE IF EXISTS #Temp IF EXISTS(SELECT [name] FROM tempdb.sys.tables WHERE [name] like '#Temp') BEGIN DROP TABLE #Temp; END; SELECT Nr1%2 + Nr2%2 + Nr3%2 + Nr4%2 + Nr5%2 + Nr6%2 AS Odds, 6 - (Nr1%2 + Nr2%2 + Nr3%2 + Nr4%2 + Nr5%2 + Nr6%2) AS Evens INTO #Temp FROM MyTable SELECT 'Total Odds = ' + CAST(SUM(Odds) AS NVARCHAR) FROM #Temp SELECT 'Total Evens = ' + CAST(SUM(Evens) AS NVARCHAR) FROM #Temp DROP TABLE #Temp

The commented out line is for SQL2016 and greater, for lower version use the second version.

I'll leave the other SELECTs to you to work out!