Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql missing records from another table

-- Returns missing my_table1 ID in my_table2 
SELECT DISTINCT t1.* FROM my_table t1
LEFT OUTER JOIN my_table2 t2
ON t1.ID = t2.ID
WHERE t2.ID is null;
-- Or:
SELECT t1.* FROM my_table1 t1 WHERE NOT EXISTS 
   (SELECT ID FROM my_table2 t2 WHERE t2.ID = t1.ID);
-- Or:
SELECT t1.* FROM my_table1 t1 WHERE t1.ID NOT IN 
   (SELECT ID FROM my_table2 t2 WHERE t2.ID = t1.ID);
Comment

PREVIOUS NEXT
Code Example
Sql :: reset auto increment sql server 
Sql :: what is meant by trigger in dbms 
Sql :: how to convert number to hours and minutes in oracle sql 
Sql :: sql change table name 
Sql :: set username and password for postgresql database 
Sql :: show sqlite column names 
Sql :: mysql check if string contains comma separated 
Sql :: sql server add identity column to existing table 
Sql :: sql get tables from current database you working with 
Sql :: Odoo Service is not coming up with postgresql read replica (slave) 
Sql :: select from one table where not on the other 
Sql :: oracle aleter trigger ora-01031 
Sql :: dual table in aql 
Sql :: get the mysql table columns data type mysql 
Sql :: mysql events not work 
Sql :: mysql full outer join java 
Sql :: Query the list of CITY names from STATION that do not start with vowels and do not end with vowels. Your result cannot contain duplicates. 
Sql :: mssql get all table names 
Sql :: substr sql last character 
Sql :: user privileges postgresql information_schema 
Sql :: insert current timestamp in postgresql 
Sql :: how to move a columns location in mysql 
Sql :: SQL server query column yes or no 
Sql :: delete all table oracle 
Sql :: Uncaught Error: Call to undefined function DatabaseOldmysqli_connect() 
Sql :: sql server delete top 1000 
Sql :: copy sql table to new table 
Sql :: update row in mysql 
Sql :: mysql safe mode 
Sql :: this week mysql 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =