Skip to content

Tag: sql-server

Split Characters in a cell to individual columns [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 months ago. Improve this question I have a dataset where a column contains 1 and 0 in a single cell which reference security …

How to use data from multiple similar columns as rows in SQL

I have a table as below: ItemName 1mth_presale_cost 2mth_presale_cost 1mth_postsale_cost 2mth_postsale_cost 1000 10.1 12.1 12.5 15.1 1001 20.2 15.2 25.2 17.3 I want the result to be like below table: ItemName 1mth_cost 2mth_cost 1000 10.1 12.1 1000 12.5 15.1 1001 20.2 15.2 1001 25.2 17.3 I don’t want to…

Rank Date based on today’s date

I have a simple date dimension, I’m attempting to write a Window function (without much luck..) to net the following result. where 1 is today and 0 is yesterday. What can I try next? I’m unsure what to search for. Answer Assuming the dates are continuous, we don’t even need analytic function…