2

I am using Two list. Is this possible left join using caml query? or Two list available joins available in sharepoint 2013 with out programmatically?? Is this possible in sharepoint Rest api?

Lis1 and List2

List1 columns 
Coumn1             Column2
Developer            1
Tester               2
Senior               3
Lead                 4
 

List2 columns 
Coumn1             Column2 
CTS                  1
TCS                  2
HTC                  3
L&T                  4

Output
Coumn1             Column2          Column3
CTS                Developer          1
TCS                Tester             2
HTC                Senior             3
L&T                Lead               4
I need output like this query

SELECT List2.Column1, List1.Column1, List1.Column2
 FROM List2
 LEFT JOIN List1 ON List2.Column2 = List1.Column2
3

A REST option is to $expand the query (see e.g.: How to join two lists using REST API sharepoint 2013).

A CSOM way would be to use <Join Type='LEFT' ListAlias='ListName'></Join> in your CAML (see e.g.: Sharepoint 2013 .NET CSOM CamlQuery Join)

  • I am not using SharePoint lookup concept between two list so is this possible to join to list using rest or caml? – Hasanshali Jul 13 '17 at 12:26
  • @Hasanshali $expand isn't restricted to lookup, neither is CAML's Join. Yet you need to have a common property (aka column) which is a key in joins. – moe Jul 13 '17 at 12:38
  • if you dont mine pls can u write one rest api above list??? – Hasanshali Jul 13 '17 at 18:40
  • @Hasanshali you made me confirm my word, and in fact it actually is so that a lookup is a mandatory to have with REST API. Apologizes for stating that previously wrong. In your scenario, a lookup would obviously be a recommendation to have, so it's at minimum something to strongly consider implementing. – moe Jul 13 '17 at 19:59
  • Is this possible in caml query? – Hasanshali Jul 13 '17 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.