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
Akshay ShrivastavaAkshay Shrivastava 

soql quiery in apex

Quiery1= 'select Required_car__c,Email from Lead where Status = Car Not Available';

Quiery2='select Car_Details_c from Available_c';

Now I want
Quiery3= Required_car__c==Car_details__c
can anyone help
ANUTEJANUTEJ (Salesforce Developers) 
Hi Akshay,

The mentioned details is not clear can you elaborate the scenario?

Thanks.
Akshay ShrivastavaAkshay Shrivastava
if Required_car__c value matches Car_details__c value
then I want that value in a query
 
mukesh guptamukesh gupta
Hi Akshay,

Whay is relation ship between Available_c and Lead , after that we will able to solve it

Regards
Akshay ShrivastavaAkshay Shrivastava
hi Mukesh,
there is no relationship.
Is it neccessary to have a relationship?
 
Suraj Tripathi 47Suraj Tripathi 47
Hi Akshay Shrivastava
Greeting!

If it is not mandatory to have Query3 what you can do is,
Quiery2='select Car_Details_c from Available_c';
Quiery1= 'select Required_car__c,Email from Lead where Status = Car Not Available' and Required_car__c=Car_Details_c;

If you find your solution mark this as the best answer.

Thank you!
Regards,
Suraj Tripathi
sakhisakhi
Hi Akshay ,

Try this
select Required_car__c,Email from Lead where Status = 'Car Not Available' and Required_car__c IN (select Car_Details_c from Available_c)
mukesh guptamukesh gupta
Hi Sanjay,

Please go with concept 

you are using two buject Lead and Available_c  how to possible to fetch and compare without releationship. Please check and let me know if you have any doubt

if you need any assistanse, Please let me know!!


Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh