Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tudorn
Starting Member
4 Posts |
Posted - 2012-10-08 : 14:17:22
|
Hello,I have the folowing TitleDetailsRequest table:Title Store EN_No FR_No RequestDate ------ ------ ----- ----- -----------Title1 StoreA 1 2 2012-07-12Title1 StoreA 8 11 2012-10-05Title1 StoreB 3 4 2012-10-01Title2 StoreA 0 5 2012-09-28Title2 StoreC 6 3 2012-07-15Title4 StoreA 9 7 2012-08-10Title4 StoreB 2 5 2012-09-04Title4 StoreB 10 3 2012-10-03Title4 StoreC 7 12 2012-08-20I need to get an output of the EN_No and FR_No for all the Stores and for all the titles Title based on the latest RequestDate as follow: Title1 Title2 Title3 Title4 ------------- ------------- ------------- ------------- EN_No FR_No EN_No FR_No EN_No FR_No EN_No FR_No ------------- ------------- ------------- -------------StoreA 8 11 0 5 0 0 9 7StoreB 3 4 0 0 0 0 10 3StoreC 0 0 0 0 0 0 7 12 ------------- ------------- ------------- -------------Totals 11 15 6 8 0 0 26 22[img=left]C:\Documents and Settings\dorin.tudorica\My Documents\My Pictures\TitleDetailsRequest_Output.JPG[/img=left]The Title table have all the titles that need to be in the output, so if a title is not in the TitleDetailsRequest table (i.e. Title3) the output should just display "0". Curently there are 30 titles in the Title table but the users can add new titles so hardcoding the titles into columns will not be an option considering that the users can also add new titles.Your help with regards to this matter will be greatly appreciated.Thanks |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
tudorn
Starting Member
4 Posts |
Posted - 2013-01-06 : 04:28:48
|
Thank you Visakh.Sory I did not reply to you earlier. Your link was exactly what I needed and it helped me with the reports. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-01-06 : 10:06:34
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|