- Home
- Anonymous
- Sign in
- Create
- Ask a question
- Spaces
- Site Issues (NOT FOR DATABASE QUESTIONS)
- Explore
- Topics
- Questions
- Users
- Badges

All I need is convert Column(A1/A2) into rows and rows(1 into Jan) into columns. Input: Here A1/A2 belongs to say A and they are calculated as A1/A2 for each month. Month A1 A2 B1 B2 C1 C2 1 120 60 40 80 120 120 2 50 50 40 20 60 30 3 50 25 40 10 90 30 I need below o/p without using pivot and unpivot O/P: X Jan(1 is denoting Jan) Feb Mar A 120/60(calculation:A1/A2) 40/80 120/120 B 50/50 40/20 60/30 C 50/25 40/10 90/30 I tried but my query is too long as I am using case and Union All three times each For A1 A2,B1 B2,C1 C2 etc. Can you pls help me out. Thanks in advance

sqltsqlsqlserver
Comment

**17** People are following this question.

SQL query to include one column value for one condition and exclude other columns

Convert rows into column column into rows

Getting a date + 3 days ( using specific date) SQL

How to Calculate TOTAL business days between two days (SQL Server) (Particular case)

Retrieve the Median from a decimal column using PERCENTILE_CONT SQL

Copyright 2019 Redgate Software.
Privacy Policy