Category: SQL

Common table Expression(CTE)

Common table expressions (CTEs) allow you to break down complex SQL logic into smaller pieces.Common table expressions (CTEs) are simply defined using the WITH keyword. They allow for logic to be coded in a single place and simplify coding and maintainability. CTE is like a temporary view. CTE Syntax: A CTE must be part of a SELECT statement. […]

Update records from a table which exists in the other Table

Update Table1  A Set  Field1 = ‘Value’ Where exists(Select * from Table2 B where A.ID = B.ID)