function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
phanip adminphanip admin 

select id, lastname, account.id, account.lastname from contact where lastname!=null

HI Everyone 

Good Afternoon,

Please help me this query syntax
Actullay my secenario is null values not show to contact lastname

select id, lastname, account.id, account.lastname from contact where lastname!=null
Abhishek M.Abhishek M.
Hi phanip,

Can you please show the error you are receiving, because the query looks fine.
DeveloperSudDeveloperSud
Hi Phanip,

Chage the account.lastName to account.Name in your query. We cant query any lastname field in account object.Hope this will help you.
Let us know and mark this as solved if this answers your question.
Harshit Garg 6Harshit Garg 6

Hi Phanip,

Please use this below line.

[select id, Lastname, Account.Id , Account.Name from contact where Lastname!=null];

Please select my ans as the best ans.


Thanks,
Harshit garg
harshitgarg2591@gmail.com

EldonEldon
As others pointed out use account.name instead of account.lastname since there is no field name called lastname in account object. 

Please select one answer as best answer and close the thread if your issue got solved
Diana AdamsDiana Adams
The ways of doing business have radically altered during the past ten years. We are currently dealing with a new global market necessity that, in many ways, dictates the solutions developed by business owners (more about you can find here https://mobilunity.com/blog/offshore-software-development-company-in-pakistan/). This is especially true for the IT sector, where fierce rivalry has made cost-cutting with the least possible impact on quality a top priority. Offshore development outsourcing is one option in this situation.