Use JOIN method to form queries or use a more efficient method

Anubhav24
Mega Sage
Mega Sage

Hi All,

I have a master table where all the cars[u_cars] are stored and now there is a related [m2m] table where the customers are added.

 

A customer who is using a car ex : BMW is being used by Shark Hotels , Comfort Hotels so in the related list of customers on a BMW car record these two customers would be mapped through the m2m table.

 

Now if I have to raise a request for a particular customer and we have to select a car and the list should display all the cars not mapped to any customer and all the cars mapped to the selected customer.

What can be the most efficient way to achieve this. I am not considering database view.

1 REPLY 1

Maik Skoddow
Tera Patron
Tera Patron

Hi @Anubhav24 

 

you say "I am not considering database view" but database are the best choice and the most recommended solution for such scenarios. That way you also can provide the views to your users without any codings. And you also should consider a downside of the "join query approach for GlideRecord queries": You will have no access to the fields of the joined table.

 

Maik