Skip to content

Tag: pivot

Identifying products that a customer owns

I want to check whether my customer owns an iPhone, iPad, or Macbook. I am not looking for how many iPhone or iPad or Macbook one customer has, I just want to identify if they own any of them, or if they own any two, or if they own all three. I am thinking of using the CASE WHEN function

Creating a Pivot Table in SQL

I could use some help with creating a PIVOT table. The table that I’m looking to pivot from is: Where I want to change it into the Format of Which has the tracking number as the Row Identifier, the added columns are the Unique Values in the ‘Surcharge Reason’ column, and the values of the da…

Improve pivot view performance

I have a key-value structure for storing dynamic entities (standard EAV). I made a view for this Entity with the Pivot command. I tried to set the index for this view, but it is not possible due to the use of pivot. Is there a way to drag my data into SQL at the time of insert, Update? Because performance

Replace row with Column Data in Sql Server

I have a table with some data and I was trying to Replace the Column with Row. The above Query gives me the result in one single row data. But I want the Result in below format I have tried the Pivot Operator using Derived Column but got confused during implementation. Please help to get the correct query. An…

Merging query from same table into different columns

I’m having an issue querying a table for some information. Basically the way data was stored in the table, for every customer, its information was stored vertically and so on for others. In my case I want to display in separate columns for example only the ‘Company’ and ‘StreetAddress&…