in Education by
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 6 days ago. Improve this question I have a table with 6 columns : c1_x_base c2_y_base c3_x_first c4_y_first c5_x_second c6_y_second Now I would like to get to: x y type with as types: "base", "first" & "second. I am lost on how to make this happen in the most performant way in T-SQL. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
SELECT CASE X.Category WHEN 'Base' THEN c1_x_base WHEN 'First' THEN c3_x_first WHEN 'Second' THEN c5_x_second END AS X ,CASE X.Category WHEN 'Base' THEN c2_y_base WHEN 'First' THEN c4_y_first WHEN 'Second' THEN c6_y_second END AS Y ,X.Category FROM YourTable T CROSS APPLY ( VALUES ('Base'), ('First'), ('Second') ) X (Category);

Related questions

0 votes
    I have a rating system in which any person may review other. Each person can be judged by one person more than once. For the ... SQL? Person 1 rates Person 2 with 5 on 1.2.2011...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    I have a rating system in which any person may review other. Each person can be judged by one person more than once. For the ... SQL? Person 1 rates Person 2 with 5 on 1.2.2011...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    I try to select the Products that has a yearmodel between +1 and -1 the current year. And I only ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    I try to select the Products that has a yearmodel between +1 and -1 the current year. And I only ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    This is a question I asked on another forum which received some decent answers, but I wanted to see ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 24, 2022 in Education by JackTerrance
0 votes
    I have a stored procedure in SQL 2005. The Stored Procedure is actually creating temporary tables in the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I have a stored procedure in SQL 2005. The Stored Procedure is actually creating temporary tables in the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 18, 2022 in Education by JackTerrance
0 votes
    I have a stored procedure in SQL 2005. The Stored Procedure is actually creating temporary tables in the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 18, 2022 in Education by JackTerrance
0 votes
    I'm trying to write a query that will pull back the two most recent rows from the Bill table ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    I have the function and want to create a new column df['growth_factor'] which will have a derived value in it. ... can I achieve this? Select the correct answer from above options...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    In _______________ index instead of storing all the columns for a record together, each column is stored ... topic in portion Indexing and Hashing of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    4. It indicates the key to the different colours used to shade the columns in a chart. 5. Name at the top ... of the chart. 6 Comhinn Select the correct answer from above options...
asked Dec 30, 2021 in Education by JackTerrance
0 votes
    Match column I with column II and select the correct answer using the codes given below the columns. Column - I Political ... 2, D - 4 Select the correct answer from above options...
asked Aug 3, 2022 in Education by JackTerrance
0 votes
    Match the columns: Column I Column II (1) Physical, chemical and biological factors together form ( ... Science proposed by,electromagnetic theory engineering physics,Science nptel...
asked Nov 8, 2021 in Education by JackTerrance
0 votes
    Match the columns: Column I Column II (1) Basic functional unit in the environment (a) ... ,Science proposed by,electromagnetic theory engineering physics,Science nptel...
asked Nov 8, 2021 in Education by JackTerrance
...