Semantically you are asking “insert Competitors where doesn’t already exist”:
INSERT Competitors (cName)
SELECT DISTINCT Name
FROM CompResults cr
WHERE
NOT EXISTS (SELECT * FROM Competitors c
WHERE cr.Name = c.cName)
More Related Contents:
- What is the best way to create and populate a numbers table?
- How do I generate a random number for each row in a T-SQL select?
- Auto increment primary key in SQL Server Management Studio 2012
- What is the use of the square brackets [] in sql statements?
- Construct date from year and week number in MSSQL
- Reset AutoIncrement in SQL Server after Delete
- XML Server XML performance optimization
- SQL Server: Attach incorrect version 661
- SSMS Results to Grid – CRLF not preserved in copy/paste – any better techniques?
- How to do version control for SQL Server database?
- Get dates from a week number in T-SQL
- What are named pipes?
- How to check if a database exists in SQL Server?
- BULK INSERT with identity (auto-increment) column
- How to update primary key
- determining the character set of a table / database?
- How to split string and insert values into table in SQL Server
- Case sensitive variables in SQL Server
- How to query for Xml values and attributes from table in SQL Server?
- SQL Server 2008 Row Insert and Update timestamps
- Full text search does not work if stop word is included even though stop word list is empty
- Should I index a bit field in SQL Server?
- Setting up maven dependency for SQL Server
- Trouble Connecting to sql server Login failed. “The login is from an untrusted domain and cannot be used with Windows authentication”
- In SQL Server, how can I lock a single row in a way similar to Oracle’s “SELECT FOR UPDATE WAIT”?
- Escaping single quote in SQL Server
- SQL Server equivalent to Oracle’s CREATE OR REPLACE VIEW
- In SQL Server, how can I find everywhere a column is referenced?
- Using Full-Text Search in SQL Server 2008 across multiple tables, columns
- Convert float into varchar in SQL Server without scientific notation