+ 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