The first thing that we need to do is create a new aspx page in Sharepoint Designer. In this page we are going to add a DataFormWebpart. In the image 1 we can see our page created and the webpart added.
Now we are going to create our query between 2 lists a query named crosslist. In the right panel we are going to Data Source Library and select the link “Create a new Linked Source” into the section Linked Sources. In the image 2 we can see this section.
When we selected this link a new window is opened, in the image 3 we can see the new window opened.
Well, now we are going to configure our query and select the both list that we are using in the query. To do this we need press the button named “Configure Linked Source” in the windows opened. In the image 4 we can see the wizard to configure our query.
We are going to select the 2 list that we are going to use in our query and using the button “Add” load this list in the right section. We can select list from this site or other Sharepoint Site creating another data source library in our Sharepoint Designer. When the 2 (we can use 2 or more list) list was loaded we are going to select the button “Next” to move the next step of wizard where we are going to select the type of query, “Merge” or “Join”. In the image 5 we can see the step to configure the type of query.
Ok, after select our type of query we are going to select the button “Finish” to save the selection. In the image 6 we can see the 2 list loaded.
Once the lists were selected we can configure the columns to show order and filter to use in the query. To do this we are going to edit the lists using the link “Edit” in each list. A new window is opened to do configuration as we want. In the image 7 we can see the new windows and the options.
Now we must save the changes in the configuration and a new data source will be created in the library of Sharepoint. In the image 8 we can see the new data source and it has a context menu to do some things, for example “remove”.
In the context menu we are going to select “Show Data” to view the data in the list after our query has been run. In the image 9 we can see the list of columns and the data.
Once our query is ready to use the last step is to select the columns that we want show in the DataFormWebpart. We must enter to the Data Source Details (Show Data in the context menu in our data sour) and select the columns that will be drag and drop over the webpart DataFormWebpart. In the image 10 we can see how we can do this and after the columns were added the webpart will generate a XSLT by default.
The last step will be changing the XSLT generated by the Webpart to show the data in the page. We can change as we want this XSLT using the Sharepoint Designer.