Hello Sharepoint developers !
Have you ever tried to do a join between lists and in both of those lists needed to place a where clause? I can do it in the first list, but can't find out how to place the where in the foreign list.
I tried several solutions like this one :
using (SPWeb web = sps.OpenWeb())
{
SPList spl = web.GetList(customers);
SPQuery query = new SPQuery();
query.Query = "<Where><Eq><FieldRef Name='Suspended'/><Value Type='Boolean'>0</Value></Eq></Where>";
query.Joins=@"<Join Type='Inner' ListAlias='CountryList'><And><Eq><FieldRef Name='Country' RefType='Id'/><FieldRef List='CountryList' Name='ID'/></Eq><Eq><FieldRef List='CountryList' Name='Continent' /><Value Type='Text'>Europe</Value></Eq>
</And></Join>";
....
But this is not working. I want to get all not suspended customers coming from all towns (another list) in Europe. So I need a where in the primary list (spl) to get not suspended customers and a where in the foreign list to get towns from europe only. I can't place my where in the Join element aparently. I tried to place it in the query, giving the list alias but it's not working either.
would you have an idea ? thanks !