SQL query for the below scenario
eg: Employee table has 10 rows
The TempEmployee table has 5 rows
TempEmp table should compare with the employee table and insert rows that are not present in the TempEmp
select emp.no, emp.name from dbo.Employee emp
left join dbo.TempEmp temp on temp.no =emp.no
where emp.no is not null and ltrim(rtrim(emp.no))
Jignesh KumarPosted Dec 18, 2023, 4:41 AM
Hello Meghna,
You can try this one,
Jayraj ChhayaPosted Dec 15, 2023, 2:12 PM
To achieve this, you can use the
INSERT INTOstatement along with theSELECTstatement and theLEFT JOINclause. Here's an example SQL query that accomplishes the task:You can compare the
Employeetable with theTempEmptable and insert the rows that are not present in theTempEmptable.