I think I explained very detailed what I need in one of my posts.
Please check and let me know if anything missing in my second explanation:
Simply reposting the same thing is really not very helpful. You want help with code right? We need some tables and data to work with. You need to post create table scripts and inserts. Remember that we can't see your screen, we have no idea what your tables or data look like and we are not familiar with your project. It seems that you have some sort of EAV construct you are working with here. That is about all I can figure out.
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's splitter
.Cross Tabs and Pivots, Part 1 – Converting Rows to Columns Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs Understanding and Using APPLY (Part 1)Understanding and Using APPLY (Part 2)