Jump to content
  • 0

"Unpivot" table columns to rows


Mitch

Question

Hi all,

Have a need to convert fields to rows leaving the original table intact and storing the result in a new table (or view).  In some tools this would be referred to as an "unpivot" function.  How would I do this is Caspio?  See "Current data" and "Unpivoted data" below.  Thanks.

Current data:

  Jan Feb
Account 1 20 40
Account 2 60 10

 

Unpivoted data:

Account 1 Jan 20
Account 2 Jan 60
Account 1 Feb 40
Account 2 Feb 10
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
17 hours ago, Nuke354 said:

Hi Mitch, perhaps you can use a Trigger/Task to move the un-pivoted data version of the table to another. You can then create a loop to insert records for each column. As of now, the "un-pivot" feature is not available.
image.png.1eda513d875ce97ed9064ea49aaf5d04.png
 

Thanks!  As  a Caspio newbie would I never have come up with that.  When I had this DB in Access I would just use a series of Union queries such as:

SELECT Jan from Table1 UNION SELECT Feb from Table1 etc...

Confirming that is not possible is Caspio?  For that matter it appears that any use of SQL isn't available ?

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...