Creating one list from 3 columns

  • Thread starter Thread starter Hammy
  • Start date Start date
H

Hammy

Guest
Hi all,

I have a table "Individual" that has 3 fields in it (listing personal traits) Trait1, Trait2, Trait3

The traits are a defined list drawn from another table (traitid, traitname) and the id is stored in the Individual Table.

My users want to be able to pull a query of traits either by person (simple) or grouped by trait, then list any person that has that trait in any of their 3 trait fields.

I am having a devil of a time coming up with a query that will essentially pull each trait field, then combine them all into one long column of traits with the individual id associated so that I can group my report on that ONE field, instead of 3 groupings (one for each trait field).

Anyone follow that, and have any suggestions?

TIA
Hammy
 
Hi ,

Assuming i understood your question correctly , the following may work :)

select traitid, trait1 as Trait from Individual
union
select traitid, trait2 from Individual
union
select traitid, trait3 from Individual

Good Luck.

Gina.
 
Yep, little tweaking and it worked great!

Thanks so much!

Hammy
 

Users who are viewing this thread

Back
Top Bottom