Combining different lists data and showing it in a webpart

listsharepointweb-partswss

let me explain my current situation

i have a SharePoint site lets say it is MAIN, and a subsite lets call it SUBMAIN

in MAIN i have a list called "a" and in subMAIN i have a list called "b"

both lists have the exact same columns,

i need to show the content of both lists (ordered by modified date for example) in one webpart in the main page i know it is possible some how but couldnt get to it.

currently i am showing only the content of list "a" in a content query webpart (i have changed the way it display and added to it horizontal merquee) so it will be nice if somehow i can add contents of list"b" also to the same content query webpart (but if it is not possible in content query webpart its ok, at least let me know what other options do i have)

your help is appreciated

Best Answer

If you are using SharePoint Designer to do this, take a look at this blog.

If you are building your own web part, I would perform two queries on the SPList objects. You can then aggregate, sort, etc. the results however you would like. If you aren't familiar with SPList, you can look here for the MSDN overview.