$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content

How can I change my query results to column names

Feb 16, 2017 at 12:05 AM


avatar image
Former Member

Hi There,

I have below table need to change as 2nd table.

Item No. Item Description BP Code BP Catalog Number 12960 SANDRA-WP-BLUE/CHOCOLATE-SINGLE--54"x84" C10058 12960 SANDRA-WP-BLUE/CHOCOLATE-SINGLE--54"x84" C10068 12960 SANDRA-WP-BLUE/CHOCOLATE-SINGLE--54"x84" C10069 8.583E+11 12960 SANDRA-WP-BLUE/CHOCOLATE-SINGLE--54"x84" C10076 12960 SANDRA-WP-BLUE/CHOCOLATE-SINGLE--54"x84" C10084 8.583E+11 12960 SANDRA-WP-BLUE/CHOCOLATE-SINGLE--54"x84" C10091 12960 SANDRA-WP-BLUE/CHOCOLATE-SINGLE--54"x84" C10113 14285 WESLEY-CS-INDIGO/GRAY-4 PC -CK-102"X92" C10058 14285 WESLEY-CS-INDIGO/GRAY-4 PC -CK-102"X92" C10068 14285 WESLEY-CS-INDIGO/GRAY-4 PC -CK-102"X92" C10084 8.583E+11 14421 WESLEY-V-INDIGO/GRAY-SINGLE--18"X84" C10058 14421 WESLEY-V-INDIGO/GRAY-SINGLE--18"X84" C10076

I need them to be like this.

Row Labels C10011 C10022 C10030 C10035 C10038 C10050 16T000184 848742045152 0 8.48742E+11 16T000185 848742045169 0 8.48742E+11 16T000302 848742047453 0 8.48742E+11 16T000331 848742047736 0 8.48742E+11 16T000415 848742048467 0 8.48742E+11 16T000548 848742049815 0 8.48742E+11 16T000549 848742049822 0 8.48742E+11 16T000553 848742050019 0 8.48742E+11 16T000555 0 8.48742E+11 16T000557 0 8.48742E+11 16T000562 0 8.48742E+11
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Gaurav Bali Feb 16, 2017 at 04:20 AM

HI Azra

To convert rows to column you can use following techniques.

1) If the number of rows is fixed. You can use SubQuery as Column.

2) Use Pivot tables here are few links which might help you.



Show 4 Share
10 |10000 characters needed characters left characters exceeded

This question is about SAP HANA, not SQL Server. The pivot function you refer to is a non-standard feature provided by SQL Server and not available on SAP HANA.


Hi Lars

The tag on the question is for SQL and SAP Business One.


Yes, and the primary tag (the one above the question title) is "SAP HANA". Yes, I agree, it's not clever UI design to spread the different tags around...


Missed that one thanks for pointing out

Gaurav Bali Feb 20, 2017 at 04:48 AM

Hi Azra

In case it is HANA DB and not sql as Mr. Lars points out you might like to check the below links which explains how to transpose a table. These are the links I found while browsing though we do not use HANA and our knowledge in the field is currently limited.



10 |10000 characters needed characters left characters exceeded