Jan 1, ... One student has been assigned to multiple Subjects in a transaction table. Step 1 Create a database. SQL SQL Server. You can select from more than one table at a time. However, the precedence of the comma operator is less than that of INNER JOIN, CROSS JOIN, LEFT JOIN, and so on. If you're using SQL 2016 or newer, you can use the STRING_SPLIT function to accomplish this. Also, the second way is the older standard. SELECT StudentID, … They are just two ways to specify the same desired result. Any combination of tables or views can be specified. SQL SERVER – Create Comma Separated List From Table December 18, 2012 by Muhammad Imran I was preparing a statistical report and was stuck in one place where I needed to convert certain rows to comma separated values and put into a single row. SQL SQL Server. This answer says that the two queries in the question are equivalent. If you're using an older version of SQL Server, you should consider updating. WITH firstQuery AS ( SELECT columns FROM table ), secondQuery AS ( SELECT columns FROM second_table ) SELECT main_columns FROM tables; Notice that after the closing bracket of the first CTE and before the name of the second CTE there is a comma, then we have added the second CTE. The following illustrates the SQL SELECT statement syntax: The SQL SELECT statement is made up of several clauses: 1. selected items don't have to appear in the GROUP BY clause or be used in an aggregate function, Select data from only one table using match with another, PLSQL: Which one of the join is good in performance. Following query will give me all columns and rows from both tables.