Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

when to use Join and when to use Keep ?

Helo,

Can anyone tell me scenarios when to use Join and when to use Keep ?

tHanks

14 Replies
simospa
Partner - Specialist
Partner - Specialist

nikhilgarg
Specialist II
Specialist II
Author

Hey,

Thanks but i have already gone thru these links. But i need to know when to use Joins na dwhen to use Keep

Thanks

nikhilgarg
Specialist II
Specialist II
Author

Hey,

Thanks but i have already gone thru these links. But i need to know when to use Joins na dwhen to use Keep

Thanks

prma7799
Master III
Master III

Hi Nikhil,

When using Join after joins (Left, Right, Inner, Outer) you get single table but after Keep join Join is perform but you get second table also.



Thanks


prma7799
Master III
Master III

buzzy996
Master II
Master II

u can use joins, u want to put ur 2 tables INPUT data into ONE OUT PUT TABLE after joins used.

u can use keep, u want to put ur 2 tables INPUT data into TWO OUT PUT TABLES after joins(KEEP) used.

jagan
Luminary Alumni
Luminary Alumni

Hi Nikhil,

Generally Join is used to join two tables into a single table.  But sometimes it is not possible to join tables with many to many mapping.

Lets take and example:

Table1:

ID, Status, Date

1, Invoice Raised, 1/1/2015

1, Invoice Approved, 1/2/2015


DetailTable:

ID, Amount

1, 100

1, 200

1, 300

2, 200


When you use join for the above tables it creates 6 records (2 * 3) because of many to many join. Also we need to exclude ID 2 from DetailTable.  If we use Sum(Amount) you will get 1200, it is incorrect. So by using Left Keep we can fix this.


Hope this helps you.


Regards,

Jagan.


nikhilgarg
Specialist II
Specialist II
Author

Hey thanks it helps but i didn't understand dat u said total 1200 is

incorrect but for id 1 total sld be 1200 as there are 2 different status to

id 1. Can u plz explain a bit more.