Solved

how do i convert reqular SELECT statement to Sql Server Pivot

Posted on 2011-09-14
2
276 Views
Last Modified: 2012-05-12
Hello
I have a view as in image1 and would like make a view with PIVOT as in image 2.

Thanks
 Image 1 simple select Image 2 as Pivot
0
Comment
Question by:gabi456
2 Comments
 
LVL 21

Accepted Solution

by:
JestersGrind earned 250 total points
ID: 36535660
To do a pivot you need something to actually pivot on.  From the screenshot it doesn't appear that you have that.  Is there always exactly 2 records?  If so, you could do something like this to get the same effect.

SELECT NivdakID, MIN(Golmi), MAX(Golmi)
FROM YourTable
GROUP BY NivdakID

Greg

0
 

Author Closing Comment

by:gabi456
ID: 36535702
Your a cool guy:)

Thanks.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Email Notifications for SQL 2005 9 36
Mysql Left Join Case 10 70
tempdb log keep growing 7 34
SQL Select in Access 2003 3 27
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question