You need to sign in to do that
Don't have an account?
kerryland6
soql "or" is broken?
Hi Folks,
Can anybody please explain why "or" dosn't behave as I expect in the following...?
1. Create an opportunity with a name of "Joe Bloggs"
then run this query:
select id, Account.LastName , Name
from Opportunity where Name= 'Joe Bloggs"
you will get one result
then run this query:
select id, Account.LastName , Name
from Opportunity where Name= 'Joe Bloggs'
or Account.Lastname = 'Bloggs'
you will get zero results.
I don't know that this Opportunity is not associated with an Account (which I assume is somehow related to the empty result), but can somebody provide a query that will work whether there is an account or not?
Thanks very much for your help -- this has driven me quite mad!
Kerry
Can anybody please explain why "or" dosn't behave as I expect in the following...?
1. Create an opportunity with a name of "Joe Bloggs"
then run this query:
select id, Account.LastName , Name
from Opportunity where Name= 'Joe Bloggs"
you will get one result
then run this query:
select id, Account.LastName , Name
from Opportunity where Name= 'Joe Bloggs'
or Account.Lastname = 'Bloggs'
you will get zero results.
I don't know that this Opportunity is not associated with an Account (which I assume is somehow related to the empty result), but can somebody provide a query that will work whether there is an account or not?
Thanks very much for your help -- this has driven me quite mad!
Kerry
select id
from Opportunity where Name= 'Joe Bloggs"
and
select id
from Opportunity where Account.Lastname = 'Bloggs'
... and manually perform a union?
Thanks,
Kerry