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
- What is a stored procedure?
- Unknown column in ‘field list’ error on MySQL Update query
- Conversion failed when converting date and/or time from character string while inserting datetime
- 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
- Rename column SQL Server 2008
- The SQL OVER() clause – when and why is it useful?
- SQL Server IF EXISTS THEN 1 ELSE 2
- How to declare a variable in MySQL?
- Cannot delete or update a parent row: a foreign key constraint fails
- How do I escape a single quote in SQL Server?
- How Stuff and ‘For Xml Path’ work in SQL Server?
- #1273 – Unknown collation: ‘utf8mb4_unicode_520_ci’
- Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
- What is the definition of cardinality in SQL
- How can I return pivot table output in MySQL?
- Compare dates in MySQL
- Best way to do nested case statement logic in SQL Server
- The multi-part identifier could not be bound
- MySQL syntax for Join Update
- PDO with INSERT INTO through prepared statements
- Selecting data from two different tables without using joins
- how to drop partition without dropping data in MySQL?
- MySQL: Invalid use of group function
- Find all tables containing column with specified name – MS SQL Server
- Conversion of a varchar data type to a datetime data type resulted in an out-of-range value in SQL query
- Simple way to calculate median with MySQL
- Creating a search form in PHP to search a database?
- The ALTER TABLE statement conflicted with the FOREIGN KEY constraint
- Error 1046 No database Selected, how to resolve?
- Simple Random Samples from a Sql database
- Search text in stored procedure in SQL Server
- SQL Server IF NOT EXISTS Usage?
- What does SQL clause “GROUP BY 1” mean?
- How to SUM and SUBTRACT using SQL?
- What represents a double in sql server?
- SELECT DISTINCT on one column
- SQL select only rows with max value on a column
- TSQL PIVOT MULTIPLE COLUMNS
- MySQL – UPDATE multiple rows with different values in one query
- SQL statement not working – “Operand type clash: date is incompatible with int’
- How to create a MySQL hierarchical recursive query?
- Microsoft OLE DB Provider for SQL Server error ‘80004005’
- Is it possible to GROUP BY multiple columns using MySQL?
- Repair all tables in one go
- Equivalent of Oracle’s RowID in SQL Server
- Is there a Max function in SQL Server that takes two values like Math.Max in .NET?
- Best way to test if a row exists in a MySQL table
- sql query to return differences between two tables
- Subtract one day from datetime
- Is it possible to specify condition in Count()?
- SQL Server: Make all UPPER case to Proper Case/Title Case
- How do I query for all dates greater than a certain date in SQL Server?
- Backup a single table with its data from a database in sql server 2008
- Temporary table in SQL server causing ‘ There is already an object named’ error
- Fatal error: Call to a member function query() on null
- ERROR 1115 (42000): Unknown character set: ‘utf8mb4’
- MySQL OPTIMIZE all tables?
- MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET
- Remove Primary Key in MySQL
- How to select the last record of a table in SQL?
- Is merge statement available in MySQL
- MySQL LIKE IN()?
- Filter data based on date in sql
- Error: Duplicate entry ‘0’ for key ‘PRIMARY’
- Creating 20,000 Posts or Pages using a .csv file?
- How to Join two tables from separate databases within WordPress
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- Are database queries created using WordPress filters protected from SQL injection?
- SQL User Query by Multiple Roles using PHP
- Query WordPress database by registered date and role
- register_activation_hook isn’t adding table to DB
- SQL Error wp_commentmeta – incorrect table definition
- How do I get the posts within a certain year/date(with sql query)?
- Database Tables Lost Indexes? How to Recover?
- How do I run SQL queries on a WordPress web page? [closed]
- Order by summing multiple values
- UPDATE on SELECT results. A SQL query to swap Author with Meta Box value
- Why this query is not showing any result on wordpresss home page?
- how to insert missing tags into the posts through mySQL?
- Pull MySQL data from multiple tables and merge into 1 PHP array
- How can I write a formal sql query to get data from a custom table
- making php value numeric
- Unknown column ‘wp_posts.ID’ in ‘field list
- How to run complex query using PHP
- I wanted to Know that how can I give ingore to 0000-00-00 in my config file
- Bulk find & replace on WordPress posts/pages (minus image paths)
- Query product’s image path by category WooCommerce database?
- SQL query to delete users with multiple meta keys and comments
- update_option returns false in AJAX, how to debug?
- Improving performance of SQL sub-queries in WordPress
- The MySQL Connection could not be established., before it was joomla but i have change it into worpress
- Custom post order when using OR relation
- Woocommerce: Grab total revenue of a product over all orders
- SQL query : Select a thumbnail for a media
- SQL command to export post_content from wp_posts using phpMyAdmin
- SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta