You need to sign in to do that
Don't have an account?

SOQL query returning same row twice
In our org, we have two users whose records are returned twice when called via APEX, or via the API.
If this SOQL is executed:
Selected Id, LastViewedDate, LastReferencedDate from User where Id='005xxxxxxx'
is executed in our org, you can see where the same result is returned twice. In fact, if you include a "limit 1" on the end of that SOQL query, it STILL returns those two, identical results.
If both LastViewedDate and LastReferencedDate are removed from the query, only one result is returned for each record, which is the expected, normal behavior.
Anyone else seen anything strange like this?
If this SOQL is executed:
Selected Id, LastViewedDate, LastReferencedDate from User where Id='005xxxxxxx'
is executed in our org, you can see where the same result is returned twice. In fact, if you include a "limit 1" on the end of that SOQL query, it STILL returns those two, identical results.
If both LastViewedDate and LastReferencedDate are removed from the query, only one result is returned for each record, which is the expected, normal behavior.
Anyone else seen anything strange like this?
Are you sure you are querying the correct object?
Also if I copy your SOQL above it does not work becuase "Selected" is not a keyword it should be Select.
If you post the actual code snippet that may help.
I am querying the user object with this exact SOQL, both via anonymous APEX (through SOQLExplorer) and in an Apex class, and get the same, two-rows-for-one-record returned in both cases:
Select Id, LastViewedDate, LastReferencedDate from User where Id='005xxxxxxx'
Have you tried the same query inside Data Loader?
Instead of UserID and you query on UserName (which should also be unique).
Select Id from User where UserName ='TheUserID@TheUser.com"......
You can try opening a SFDC Support Ticket assuming you have support.