Re: Crosstab query in SQL
From: Greg O (greg_at_No-SPAM*NO(SPAM@ag-software.com)
Date: 03/11/04
- Next message: Louis Davidson: "Re: Sequential integer column in view"
- Previous message: Matthew Speed: "Re: xp_cmdshell output question"
- In reply to: Rahul Chatterjee: "Crosstab query in SQL"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 12 Mar 2004 09:19:43 +1100
HI,
The problem with crosstab reports is that you need to know the columns
before you can create the query. Using an automated toll like
xp_ags_crosstab is a better solution because you can feed in simple queries
and not worry about the crosstab works.
I suggest you look at xp_ags_crosstab, so far I have tested results with
over 8000+ and 10,000 rows with problems and results in under one minute
It is licensed per server no matter how many connection or databases
http://www.ag-software.com/xp_ags_crosstab.aspx
-- I hope this helped Greg O Save HOURS documenting your SQL Server! -- FREE Trial! http://www.ag-software.com/ags_scribe_index.aspx Crosstab Queries without OLAP -- 30 day free Trial! http://www.ag-software.com/xp_ags_crosstab.aspx "Rahul Chatterjee" <rahul@benesysinc.com> wrote in message news:Oo3Nip2BEHA.2804@tk2msftngp13.phx.gbl... > Hello All > > I have a sql table which has information like > > Area Plan EmployeeCnt Coverage > 1 A 2 S > 1 A 1 F > 1 B 1 F > 2 A 3 2Person > 2 A 1 S > 2 C 1 F > > > I export the table into access and use a crosstab query (as below) to create > a report > > TRANSFORM Sum(L100PHARMACYCENSUSREPORT.EMPCNT) AS SumOfEMPCNT > SELECT L100PHARMACYCENSUSREPORT.AREA, L100PHARMACYCENSUSREPORT.PLANTYP > FROM L100PHARMACYCENSUSREPORT > WHERE (((L100PHARMACYCENSUSREPORT.DEP3)<>'B') AND > ((L100PHARMACYCENSUSREPORT.AREA)<>'')) > GROUP BY L100PHARMACYCENSUSREPORT.AREA, L100PHARMACYCENSUSREPORT.PLANTYP, > L100PHARMACYCENSUSREPORT.AREA > PIVOT L100PHARMACYCENSUSREPORT.DEP3; > > > Area Plan Single 2Person Family > 1 A 2 1 > 1 B 1 > 2 A 1 3 > 2 C 1 > > > How would I do the same thing in SQL server itself without having to export > to Access > > Thanks > >
- Next message: Louis Davidson: "Re: Sequential integer column in view"
- Previous message: Matthew Speed: "Re: xp_cmdshell output question"
- In reply to: Rahul Chatterjee: "Crosstab query in SQL"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|