Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql find missing values

-- Find missing t1 values in t2 (based on 'id' field)
SELECT * FROM t1 WHERE t1.id NOT IN (SELECT id FROM t2);
-- or
SELECT * FROM t1 WHERE NOT exists (
    SELECT NULL FROM t2 WHERE t2.id = t1.id
);
-- or
SELECT t1.* FROM t1 LEFT OUTER JOIN t2 ON t2.id = t1.id WHERE t2.id IS NULL;
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql delete user if exists 
Sql :: SELECT table_name FROM user_tables; 
Sql :: sql select max value from multiple rows 
Sql :: sqlite3 read only 
Sql :: mysql grant grant option 
Sql :: spring import sql 
Sql :: mysqldump: Got error: 1045: Access denied for user 
Sql :: wordpress delete post revisions older than date "sql" 
Sql :: truncate statement in sql 
Sql :: mysql query bulk insert 
Sql :: mysql version query 
Sql :: sql update table remove spaces 
Sql :: mssql disable foreign key constraint 
Sql :: mysql regex replace 
Sql :: change row in sql 
Sql :: how to get nears location in mysql with latitude and longitude 
Sql :: CONCAT_WS() concat function in mysql 
Sql :: is between inclusive or exclusive sql 
Sql :: psql fatal database does not exist 
Sql :: search for replace in mysql 
Sql :: postgres json to string 
Sql :: sql server list locks 
Sql :: create table in microsoft sql server 
Sql :: sql function 
Sql :: select first and last row sql 
Sql :: sql query to get the number of rows in a table 
Sql :: search mysql database for column 
Sql :: kill a pid redshift 
Sql :: how to generate a unique random number in mysql 
Sql :: oracle list grants on package 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =