TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
49
2.5k
Not getting expected output while using PIVOT in Sql Server
Oct 13 2016 2:31 AM
Following is my SqlServer table<br /><div><img src="/forums/uploadfile/3399e6/10132016020512AM/Table.PNG" alt="" /></div><div> I expected result as below</div><div><img src="/forums/uploadfile/3399e6/10132016020512AM/Expected Output.PNG" alt="" /> In above output i want count of student who paid their fees. at the same time i want to group that count by fee_type, date and class_division.</div><div> </div><div>I am using PIVOT for achieve this result.</div><div>Following is my query</div><div><img src="/forums/uploadfile/3399e6/10132016020512AM/Sql query.PNG" alt="" /> </div><div> But not getting result as i expected.</div><div><img src="/forums/uploadfile/3399e6/10132016020512AM/Sql Output.PNG" alt="" /> </div><div> This is what i am getting after execution of my query. which is totally wrong.</div><div> </div><div>Please let me know if there is any solution to get expected result.</div><div> </div><div>Thanks</div><div> </div><div> </div><div> </div><div> </div>
Reply
Answers (
2
)
How to Take Backup of Sql server Database using script
Learning SQL Server