Home » SQL & PL/SQL » SQL & PL/SQL » Is the line of code below redundant?
Is the line of code below redundant? [message #202446] Thu, 09 November 2006 21:05 Go to next message
philips84
Messages: 1
Registered: November 2006
Junior Member
hi,

Looking at the query given below, I would like to know is "t2.cola IS NOT NULL" redundant in the second LEFT JOIN condition?

select * from ((t1 
left join t2 on t1.cola  = t2.cola AND t1.cola is null and t2.cola is null)
left join t3 on t2.cola  = t3.cola AND t2.cola is null and t3.cola is null)


Since, i have defined it in the first context, do i need to define it again in the second context?

Thanks,
Phil
Re: Is the line of code below redundant? [message #202486 is a reply to message #202446] Fri, 10 November 2006 00:36 Go to previous messageGo to next message
amul
Messages: 252
Registered: April 2001
Location: Chennai
Senior Member
no
Re: Is the line of code below redundant? [message #202644 is a reply to message #202486] Fri, 10 November 2006 12:05 Go to previous message
skooman
Messages: 912
Registered: March 2005
Location: Netherlands
Senior Member
Furthermore, since you use join and not outerjoin, all the "is not null" parts are redundant... Join means equijoin and since null=null evaluates to null (read: I don't know, how can I tell if something I don't know the value of equals something else I don't know the value of?), all the null values will be eliminated from the result anyway.

All this assuming that you meant to type IS NOT NULL, instead of IS NULL (as is says in your post). Joining tables on columns you want to contain null doesn't make much sense, does it?

Regards,
Sabine
Previous Topic: how to find the number of days(ie the number of mondays) between 2 dates
Next Topic: Single quotes in a SQL query
Goto Forum:
  


Current Time: Sun Dec 04 16:34:40 CST 2016

Total time taken to generate the page: 0.10173 seconds