Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opposite of cross tab

Status
Not open for further replies.

ddeegan

Programmer
Jun 17, 2002
193
US
Hello

I am trying to get data in Example 1 to look like the data in Example 2

Example 1:
field1 | field2 | field3
A B C

to look like...

Example 2:
field1 | field2
A B
A C

Below is a sample of the code I used to get Example 1.

How do I change this to give results like Example 2?

select
T1.field1,
T1.field2,
T2.field1
T2.field3
from Company T1
inner join
Table2 T2
on T1.field1=T2.field1
inner join
Table3 T3
on T2.field1=Tfield3
where T1.field1='sample'

Thanks in advance
Dave
 
What about...

Code:
Select Field1,
       Field[!]2[/!]
From   Company

Union All

Select Field1,
       Field[!]3[/!]
From   Company

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top