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
narendevnarendev 

SOQL queries on following Tables SUPPLIERS,PARTS,SHIPMENTS

Please Help me out in these queries.

 

 

1)    Get supplier names for suppliers who supply all parts.

2)    Get all pairs of supplier numbers who reside in the same city.

3)    Get supplier names for suppliers who donot supply part p2.

 

 

SUPPLIERS

     

SUPPLIER_NUMBER

SUPPLIER_NAME

STATUS

CITY

  

S1

SARLA

20

MUMBAI

  

S2

UMA

10

CHENNAI

  

S3

NEHRU

30

CHENNAI

  

S4

PRIYA

20

MUMBAI

  

S5

ANAND

30

DELHI

  
      

PARTS

     

PART NUMBER

PART NAME

COLOR

WEIGHT

CITY

 

P1

NUT

RED

12

MUMBAI

 

P2

BOLT

GREEN

17

CHENNAI

 

P3

SCREW

BLUE

17

BENGALURU

 

P4

SCREW

RED

14

MUMBAI

 

P5

CAM

BLUE

12

CHENNAI

 

P6

COG

RED

19

MUMBAI

 
      

SHIPMENTS

     

SUPPLIER NUMBER

PART NUMBER

QUANTITY

   

S1

P1

300

   

S1

P2

200

   

S1

P3

400

   

S1

P4

200

   

S1

P5

100

   

S1

P6

100

   

S2

P1

300

   

S2

P2

400

   

S3

P2

400

   

S4

P2

200

   

S4

P4

300

   

S4

P5

400

   
      

 

Suresh RaghuramSuresh Raghuram

if you want just only the queries they are as follows

 

1.     [select supplier_ name__c from suppliers__c];    __c is for custom objects only not for standard objects

2.     [select SUPPLIER_NUMBER from suppliers__c group by city__c];

3.     [select [select supplier_ name__c from suppliers__c] from parts where Part_Numbet <> p2];

if this answers your question make this as a solution


narendevnarendev

Hi Suree

 

Thanks for responding for the Queries, For the first Query (1.  Get supplier names for suppliers who supply all parts.

i hope the answer should be ----- Sarala,

 

From SHIPMENTS Table its clear that only Sarala supplies all Parts,so there will be a relationship between these two tables,so please check it over

 

From the Answer [select supplier_ name__c from suppliers__c]; i hope we get all the names of  SUPPLIERS.

 

Thanks.