Link to home
Start Free TrialLog in
Avatar of aferia
aferia

asked on

SQL is not Short Circuit in join clause

I have a SQL statement that needs to short-circuit in a join clause, but the short circuit is not happening, which is not acceptable for the type of query I am building.
The query bellow illustrates the issue:

select * from Table1 join Table2 on Table1.CusName = 'NEVER' and 1/0 = 0

Where there are no records with CusName = 'NEVER'
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great link, dodge20.
Ehem. I told you it is not working. The article just illustrates that it works sometimes, but isn't reliable.
Avatar of aferia
aferia

ASKER

I originally missed Qlemo's answer and I tried to give him points after, but I could not figure out how to redistribute it. Please advice on how I can achieve this.
I have no issues with splitting the points. Qlemo's answer is correct, my link just provided examples showing how each scenario doesn't work.