Yes: You can use Inner Join
to join on multiple columns.
SELECT E.CaseNum, E.FileNum, E.ActivityNum, E.Grade, V.Score from Evaluation E INNER JOIN Value V ON E.CaseNum = V.CaseNum AND E.FileNum = V.FileNum AND E.ActivityNum = V.ActivityNum
Create table
CREATE TABLE MyNewTab(CaseNum int, FileNum int, ActivityNum int, Grade int, Score varchar(100))
Insert values
INSERT INTO MyNewTab Values(CaseNum, FileNum, ActivityNum, Grade, Score) SELECT E.CaseNum, E.FileNum, E.ActivityNum, E.Grade, V.Score from Evaluation E INNER JOIN Value V ON E.CaseNum = V.CaseNum AND E.FileNum = V.FileNum AND E.ActivityNum = V.ActivityNum
Related Posts:
- When to use SELECT … FOR UPDATE?
- How to join two tables by multiple columns in SQL?
- Operand type clash: int is incompatible with date + The INSERT statement conflicted with the FOREIGN KEY constraint
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- Selecting COUNT(*) with DISTINCT
- Case in Select Statement
- What is a stored procedure?
- Inserting multiple rows in a single SQL query? [duplicate]
- Unknown column in ‘field list’ error on MySQL Update query
- Unknown column in ‘field list’ error on MySQL Update query
- Conversion failed when converting date and/or time from character string while inserting datetime
- Self Join to get employee manager name
- How do I UPDATE from a SELECT in SQL Server?
- SQL query to select dates between two dates
- What’s the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN? [duplicate]
- MySQL – Operand should contain 1 column(s)
- Conversion failed when converting date and/or time from character string while inserting datetime
- When should I use CROSS APPLY over INNER JOIN?
- MySQL “CREATE TABLE IF NOT EXISTS” -> Error 1050
- Insert Data Into Temp Table with Query
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- SQL query to get the employee name and their manager name from the same table
- MySQL create table if not exists and insert record only if table was created
- error, string or binary data would be truncated when trying to insert
- How to create Temp table with SELECT * INTO tempTable FROM CTE Query
- NOT IN vs NOT EXISTS
- How can I do an UPDATE statement with JOIN in SQL Server?
- Must declare the scalar variable
- T-SQL split string
- How do I use properly CASE..WHEN in MySQL
- Must declare the scalar variable
- Rename column SQL Server 2008
- INSERT statement conflicted with the FOREIGN KEY constraint – SQL Server
- Efficiently convert rows to columns in sql server
- How to turn IDENTITY_INSERT on and off using SQL Server 2008?sql-server-2008
- The SQL OVER() clause – when and why is it useful?
- Update multiple columns in SQL
- How can I do a FULL OUTER JOIN in MySQL?
- Nested select statement in SQL Server
- INSERT statement conflicted with the FOREIGN KEY constraint – SQL Server
- MySQL query String contains
- How do I escape a single quote in SQL Server?
- What’s the difference between VARCHAR and CHAR?
- Cannot delete or update a parent row: a foreign key constraint fails
- Cannot delete or update a parent row: a foreign key constraint fails
- SQL Server IF EXISTS THEN 1 ELSE 2
- Case statement in MySQL
- How to update multiple columns in single update statement in DB2
- Rename a column in MySQL
- T-SQL split string based on delimiter
- How to declare a variable in MySQL?
- Cannot delete or update a parent row: a foreign key constraint fails
- SQL Query with SUM with Group By
- MySQL Every derived table must have its own alias
- MySQL Cannot Add Foreign Key Constraint
- How do I restore a dump file from mysqldump?
- Drop a temporary table if it exists
- How do I perform an IF…THEN in an SQL SELECT?
- How do I escape a single quote in SQL Server?
- How Stuff and ‘For Xml Path’ work in SQL Server?
- Data source name not found, and no default driver specified
- IDENTITY_INSERT is set to OFF – How to turn it ON?
- SQL update from one Table to another based on a ID match
- How do I import an SQL file using the command line in MySQL?
- #1273 – Unknown collation: ‘utf8mb4_unicode_520_ci’
- Conversion of a varchar data type to a datetime data type resulted in an out-of-range value in SQL query
- How to split the name string in mysql?
- What does SQL Select symbol || mean?
- How do I import an SQL file using the command line in MySQL?
- Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
- mysql Foreign key constraint is incorrectly formed error
- How to drop all tables from a database with one SQL query?
- SQL Server : Arithmetic overflow error converting expression to data type int
- What is the definition of cardinality in SQL
- MySQL: Invalid use of group function
- How to calculate percentage with a SQL statement
- Column name or number of supplied values does not match table definition
- Inserting data into a temporary table
- Can a foreign key be NULL and/or duplicate?
- Why does NULL = NULL evaluate to false in SQL server
- CREATE VIEW must be the only statement in the batch
- How can I return pivot table output in MySQL?
- SQL Server FOR EACH Loop
- Difference between JOIN and INNER JOIN
- Query comparing dates in SQL
- Compare dates in MySQL
- SQL Query Where Field DOES NOT Contain $x
- Best way to do nested case statement logic in SQL Server
- What is the meaning of the prefix N in T-SQL statements and when should I use it?
- MySQL “WITH” clause
- MySQL Multiple Joins in one query?
- Error Code: 2013. Lost connection to MySQL server during query
- The multi-part identifier could not be bound
- “CASE” statement within “WHERE” clause in SQL Server 2008
- MySQL syntax for Join Update
- PDO with INSERT INTO through prepared statements
- Column ‘user_id’ in field list is ambiguous
- Get day of week in SQL Server 2005/2008
- Query error with ambiguous column name in SQL