By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,107 Members | 1,323 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,107 IT Pros & Developers. It's quick & easy.

strange behaviour?

P: n/a
Hi, I'm encountering problems with an sql statement, the problem occurs
with this line:

'and addresses.[direct address] = yes'

2 records are returned here, if I change it to

'and addresses.[direct address] = no'

again 2 records are displayed (different ones).. the strange thing is if I
run as:

'and addresses.[direct address] = yes or addresses.[direct address] = no'

This returns all records (as it should), but there's more than 4! (tens of
thousands of records to be precise)

So what's going on here? I'm hoping it's a common, simple slip-up that I can
easily fix!

Cheers,
Chris
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
C L Humphreys wrote:
Hi, I'm encountering problems with an sql statement, the problem occurs
with this line:

'and addresses.[direct address] = yes'

2 records are returned here, if I change it to

'and addresses.[direct address] = no'

again 2 records are displayed (different ones).. the strange thing is if I
run as:

'and addresses.[direct address] = yes or addresses.[direct address] = no'

This returns all records (as it should), but there's more than 4! (tens of
thousands of records to be precise)


We need to know what else is in the query's Where clause.
What you have is probably something like:

Where x=1 and [direct address] = yes

but when you use both conditions you get:

Where x=1 and [direct address]=yes or [direct address]=no

which is processed as if it were:

Where (x=1 and [direct address]=yes) or [direct address]=no

--
Marsh
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.