Skip to main content

Posts

Pivot Table in SQL SERVER 2005

SELECT /* non-pivoted column > , [ first pivoted column ] AS column name > , [ second pivoted column ] AS column name > , ... [ last pivoted column ] AS column name > */ ItemCode, ItemName, [1] AS Price1, [2] AS Price2, [3] AS Price3, [4] AS Price4, [5] AS Price5, [6] AS Price6, [7] AS Price7, [8] AS Price8, [9] AS Price9, [10] AS Price10 FROM -- this is the query that produces the data> (SELECT A.ItemCode, A.ItemName, B.PriceList, B.Price FROM OITM A INNER JOIN ITM1 B ON A.ItemCode=B.ItemCode WHERE A.ItemCode LIKE '11%') AS SourceTable PIVOT ( -- aggregation function> MAX(Price) FOR -- column that contains the values that will become column headers > PriceList IN -- ([first pivoted column], [second pivoted column],... [last pivoted column] ) ([1], [2], [3], [4], [5], [6], [7], [8], [9], [10]) ) AS pvt ORDER BY ItemCode; here is the equivalent code for SQL SERVER 2000 SELECT A.ItemCode, A.ItemName, MAX(CASE B.Price...

Chasing .NET again..:D

been a while again .. been married for almost 2 weeks now :shy: for precisely 14 Sept 2007 me and natalia just married at Vihara Jakarta Dhamma Cakka Jaya at 11 AM.. starting to build family and for that i must proceed the Certificate in order to get a better salary and after that will pursue a better job PS: gonna need to set up my mind to less play DoTa.. until then

What i'm doing now?

simply just doing job like programming..doesn't had a chance to read some book too after my last failed exam :(..oo btw the exam that i took several weeks ago is failed i get 539 from 700 passing grade.. gonna married soon..Sep, 15 2007 for exactly and of course i need to get better job for my family..not sure where to start.. i like it here (at IDU) but the salary is not enough for a starting family i think, maybe it's because of my laziness that slow down my progress to get the certificate..bad me.. need to relax now..see u
learn something new..if it involved transaction between two different server it need to be used four part name something like this ServerName.DbName.OwnerName.TableName in my case: SELECT * FROM [myComputer].Db1.dbo.Table1 until then

MCSD on the road

finally, after a couple time posponed due project..in this friday, 10 Aug 2007 i will start getting my exam for MCSD go for 70-229 topic first and the rest in every two weeks i hope :D need to learn now :D