How can you combine the columns of two queries together?
My SQL Server Udemy courses are:
70-461, 70-761 Querying Microsoft SQL Server with T-SQL: https://rebrand.ly/querying-microsoft...
98-364: Database Fundamentals (Microsoft SQL Server): https://rebrand.ly/database-fundamentals
70-462 SQL Server Database Administration (DBA): https://rebrand.ly/sql-server-dba
Microsoft SQL Server Reporting Services (SSRS): https://rebrand.ly/sql-server-ssrs
SQL Server Integration Services (SSIS): https://rebrand.ly/sql-server-ssis
SQL Server Analysis Services (SSAS): https://rebrand.ly/sql-server-ssas-mdx
Microsoft Power Pivot (Excel) and SSAS (Tabular DAX model): https://rebrand.ly/microsoft-powerpiv...
----
There are multiple ways to combine the columns of queries together.
One way is by using a correlated query. Another way is to add a second calculation.
If you want to do this as a Practice Activity, then here's the original code.
The original query is (with a minor modification, so I can post it here):
SELECT type_desc, COUNT(*) AS NumberOfObjects
FROM sys.objects
GROUP BY type_desc
SELECT type_desc, COUNT(*) AS NumberOfObjectsIn2022
FROM sys.objects
WHERE YEAR(create_date) = 2022
GROUP BY type_desc
----
Links to my website are:
70-461, 70-761 Querying Microsoft SQL Server with T-SQL: http://idodata.com/querying-microsoft...
98-364: Database Fundamentals (Microsoft SQL Server): http://idodata.com/database-fundament...
SQL Server Essential in an Hour: http://idodata.com/sql-server-essenti...
70-462 SQL Server Database Administration (DBA): http://idodata.com/sql-server-databas...
DP-300: Administering Relational Databases: http://idodata.com/dp-300-administeri...
Microsoft SQL Server Reporting Services (SSRS): http://idodata.com/microsoft-sql-serv...
SQL Server Integration Services (SSIS): http://idodata.com/sql-server-integra...
SQL Server Analysis Services (SSAS): http://idodata.com/sql-server-ssas-mu...
Microsoft Power Pivot (Excel) and SSAS (Tabular DAX model): https://rebrand.ly/microsoft-powerpiv...
1Z0-071 Oracle SQL Developer – certified associate: http://idodata.com/iz0-071-oracle-sql...
SQL for Microsoft Access: http://idodata.com/sql-for-microsoft-...
DP-900: Microsoft Azure Data Fundamentals: http://idodata.com/dp-900-microsoft-a...
On this page of the site you can watch the video online Practice Activity: Adding the column from one query into another query in SQL Server. with a duration of hours minute second in good quality, which was uploaded by the user SQL Server 101 07 December 2023, share the link with friends and acquaintances, this video has already been watched 845 times on youtube and it was liked by 20 viewers. Enjoy your viewing!