I need to use a Select Statement inside a Select Statement.
Select * from Table1
where Id in (Select * from Table2)
Is this possible?
This would eliminate the need to get all Records from Table2 and then Join with Table1 and speed up my workflows.
Thanks! John!
just replace the 2nd * with ID
Select * from Table1
where Id in (Select ID from Table2)
There is a long list of Ids, not just one. Now I have to get the Ids from 1 Input Tool, copy and paste them into a 2nd Input Tool. It takes way too much time to do that multiple times a day.
Can you give an example?
select "Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC".Order_Status__c.Id,
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC".Order_Status__c.Distributor_PO_Number__c,
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC".Order_Status__c.SAP_Order__c,
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC".Order_Status__c.Customer_Reference_Number__c,
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC".Order_Status__c.Account_Name__c
from "Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC".Order_Status__c
where
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC".Order_Status__c.Account_Name__c like 'Trane%'
and
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC".Order_Status__c.SAP_Order__c in (select "Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC"."Case".Id as CaseId,
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC"."Case".IsClosed,
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC"."Case".Order_Status_Number__c,
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC"."Case".Customer_Reference_Number__c,
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC"."Case".Record_Type_Name__c,
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC"."Case".SAP_Order__c,
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC"."Case".Distributor_Order_Number__c,
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC"."Case".CreatedDate
from "Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC"."Case"
where "Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC"."Case".Order_Status_Number__c is NULL
and "Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC"."Case".Record_Type_Name__c in ('Order Alternate Contact', 'Order Expedite Request', 'Order Inquiry', 'Order Inquiry (Closed)', 'Order Modification Request', 'RGA')
and
"Mitsubishi Electric Trane HVAC US LLC"."Mitsubishi Electric Trane HVAC US LLC"."Case".SAP_Order__c is NOT NULL)