Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I just want to say how much I value your site. I hope the good work keeps up there. It's really helped me..."

Geography

Where in the world do Tek-Tips members come from?
raji96 (Programmer)
3 Jan 02 9:19
Hi,

I have an sql like this

select distinct b.field3
from
table1 a,
table2 b,
table3 c,
table4 d
where
c.field5="something" and
c.feild2=b.field2 and
(((b.field2=a.field2) and (b.field3=a.field3)) or
 ((b.field2=c.field2) and (b.field3=c.field3)))


when this is executed ((b.field2=a.field2) and (b.field3=a.field3)) is basically has no rows in the table hence the condition is something like null or somerows.

But even though the second condition((b.field2=c.field2) and (b.field3=c.field3)) is true
the end result is always 'no rows return'.why is it?

since the second condition is true and has rows and the first one is false and since i am using or shouldn't it return the rows.
karluk (MIS)
7 Jan 02 16:11
I get rows returned when I do a similar query on my database.  Maybe the extra condition, c.field5="something", is causing your result to be null.

By the way, I suppose your query is a simplification, but it's not clear why you include table4 in your sql.  It's never referenced.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close