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
amyamyamyamyamyamy 

SOQL select from temp table

Is it possible to convert the SQL query below to SOQL???

 

select * from (select * from table where email = 'abc@gmail.com' order by CreatedDate ) limit 1

 

Thank you!!

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox
SELECT ... FROM ... WHERE ... ORDER BY CREATED DATE LIMIT 1

There's no temporary tables in SOQL, but this query will do the same thing.

All Answers

sfdcfoxsfdcfox
SELECT ... FROM ... WHERE ... ORDER BY CREATED DATE LIMIT 1

There's no temporary tables in SOQL, but this query will do the same thing.
This was selected as the best answer
souvik9086souvik9086

You can't use * in SOQL and there is no temp table as well.

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

Avidev9Avidev9
have a look at this post http://corycowgill.blogspot.in/2011/01/building-dynamic-soql-select-all-query.html

This may help you to build the * alternative using dynamic query
Sanjay BarmanSanjay Barman
select a1.Pid from (select Pid from relation where AId = 1)a1 join        
(select Pid from relation where AId = 2)a2 where a1.Pid = a2.Pid;



how do i write this SQL query in SOQL please help me