Microsoft SQL server Azure
How to sum the amount in one column?
Inside SSMS enter this, to sum column [amount] all rows that have active=”y’ and date = 20221201.
SELECT SUM(amount) FROM [DM].[table1] where [Active] = 'Y' and [sDate] = '20221201'
To list all rows from two identical tables, including duplicates enter:
SELECT column_name(s) FROM table1 UNION ALL SELECT column_name(s) FROM table2
List number of rows from a table, from a selection:
select count(*) FROM [DM].[table1] WHERE [Active] = 'Y'
How copy a number of rows into a new table:
SELECT * INTO [DM].[table1] FROM [DM].[table2] WHERE [active] = 'N';