Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hello, Please help me to query the records from a table and display the records in horizontally for a report.
I have a table with records in 4 fields:
Region Store Month_Year Number ------------------------------------------------ East Wal-Mart January2017 100 East Wal-Mart February2017 100 East Wal-Mart March2017 200 East Wal-Mart April2017 300 East Wal-Mart May2017 100 East Kmart February2017 200 East Kmart March2017 100 East Kmart May2017 200 East Target January2017 100 East Target February2017 200 East Target April2017 100 East Target May2017 300 West Wal-Mart January2017 100 West Wal-Mart February2017 200 West Wal-Mart April2017 200 West Wal-Mart May2017 400 West Kmart January2017 300 West Kmart March2017 200 West Kmart April2017 100 West Kmart May2017 200 West Target January2017 300 West Target February2017 200 West Target March2017 500 West Target May2017 200 North … South …
What I’m trying to display in report is group by region, Store and list Number by each Month_Year. Also, list the YTD Amount of the Store at the right column and Month total in the bottom of each Month like this: