Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Access crosstab query conversion

Author  Topic 

knowledge
Starting Member

3 Posts

Posted - 2005-10-27 : 14:01:45
Hello Friends,
I am new here and also to SQL Server. I am making an Access frontend and SQL Server backend application. Almost everything is now working except this query which I tried to convert to SQL Server syntax but without any success. Hope you people will show me how it really works. Thanks


TRANSFORM First([Messung_Ottensen].[CSB])
AS [SummeVonMessung_Ottensen_NO2_N Nitritstickstoff]
SELECT (Format([Dat],"dd mmm yyyy"))
AS Ausdr1 FROM Messung1
WHERE (((Messung1.Dat)>#9/1/2003#) AND ((Messung1.Messung_Ottensen.Projekt)="ottensen")
AND ((Messung1.Hangwasseranalyse)<>-1))
GROUP BY (Year([Dat])*12+Month([Dat])-1),
Messung1.Dat, (Format([Dat],"dd mmm yyyy")), Messung1.Hangwasseranalyse
PIVOT Messung1.Messung_Ottensen.Projekt;

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2005-10-28 : 01:49:49
SQL Server (2000) does not have a TRANSFORM command. You will need to construct your crosstab using CASE statements. If you look up CROSSTAB in Books Online you will find an excellent explanation and example of how to do this.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-28 : 02:57:54
Refer this
http://weblogs.sqlteam.com/jeffs/archive/2005/05.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

knowledge
Starting Member

3 Posts

Posted - 2005-10-28 : 08:39:05
As a beginner I have a very limited knowledge of SQL server so could you please show me your SQL Server version of the crosstab query.Thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-28 : 08:58:25
Did you look at the Link I specified?
Also goto Article section and search for Cross tab

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

knowledge
Starting Member

3 Posts

Posted - 2005-10-28 : 10:02:01
yes i went to link you have given but I think it will take its time till I am familiar with SQL Server and its syntax.
Go to Top of Page
   

- Advertisement -