Except in Sql

It's a wonderful functionality in SQL. You may have crossed the situation to select the records those are not available in the second table. However We may use joins to do this. Alternatively we have  direct way to do this by using "Except" keyword. I hope this would be more helpful for you.

We must have equal number of expressions in both queries.

Example

select invoiceid from invoicepayment where invoiceid in(1,2,3)
Except
select invoiceid from invoice where invoiceid in(1,2)

Output
3

Comments

Popular posts from this blog

Types of Architects

Basic measurements

Search html table contents based on its td using Jquery