Q
Problem solve Get help with specific problems with your technologies, process and projects.

A "crosstab" query

I would like to generate a report from an SQL database where, for example, I have a table like this:

Field1  Field2  Field3
A       a1      2
A       a2      3
B       a1      1
C       a1      4
C       a2      3
D       a2      2

The report will look like this:

Field1  A1   A2     
A       2    3
B       1    0
C       4    3
D       0    2

How will I put this in a query?

This was last published in October 2003

Dig Deeper on Oracle and SQL

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close