Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
T-SQL (SS2K8)
»
cross tab query
cross tab query
Rate Topic
Display Mode
Topic Options
Author
Message
imfairozkhan
imfairozkhan
Posted Tuesday, January 15, 2013 1:01 AM
Grasshopper
Group: General Forum Members
Last Login: Tuesday, January 15, 2013 2:02 AM
Points: 18,
Visits: 42
hi all,
how do i achieve this result
division 2012 2013 2014 2015 2016
xyz 1 0 0 0 10
abcd 11 0 0 0 9
lmn 3 0 0 0 5
i have data for year 2012 and 2016 there is no data for 2013,2014,2015.
please help me achieve this.
any help is highly appreciated.
regards
fairozkhan
Post #1407061
dwain.c
dwain.c
Posted Tuesday, January 15, 2013 1:34 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 6:03 AM
Points: 2,345,
Visits: 3,191
Hi there!
You've given us your expected results, but we need some DDL and test data to show you how to get them.
This article provides excellent guidelines:
Forum Etiquette: How to post data/code on a forum to get the best help
No loops! No CURSORs! No RBAR! Hoo-uh!
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Are you too recursively challenged?
Splitting strings based on patterns can be fast!
Post #1407076
imfairozkhan
imfairozkhan
Posted Tuesday, January 15, 2013 2:03 AM
Grasshopper
Group: General Forum Members
Last Login: Tuesday, January 15, 2013 2:02 AM
Points: 18,
Visits: 42
data what i have
division 2012 2013 2016
xyz 1 0 10
abcd 11 1 9
lmn 9 4 11
regards
Post #1407092
dwain.c
dwain.c
Posted Tuesday, January 15, 2013 2:08 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 6:03 AM
Points: 2,345,
Visits: 3,191
imfairozkhan (1/15/2013)
data what i have
division 2012 2013 2016
xyz 1 0 10
abcd 11 1 9
lmn 9 4 11
regards
I think I speak from experience when I say that people here really want to help you. However we're all volunteers. So to get good, tested code you really need to follow the guidelines that are in the article link that I posted. You have not, which leads me to believe you didn't read it.
No loops! No CURSORs! No RBAR! Hoo-uh!
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?
Since random numbers are too important to be left to chance, let's generate some!
Are you too recursively challenged?
Splitting strings based on patterns can be fast!
Post #1407094
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.