I have a many-to-one relationship between Animals and their attributes. Because different Animals have different attributes, I want to be able to select all animals with their attribute name as a column header and NULL values where that animal does not have that attribute.
Like so...
TABLE_ANIMALS
ID  | ANIMAL      | DATE          | MORE COLS....
1   | CAT         | 2012-01-10    | ....
2   | DOG         | 2012-01-10    | ....
3   | FROG        | 2012-01-10    | ....
...
TABLE_ATTRIBUTES
ID  | ANIMAL_ID | ATTRIBUE_NAME     | ATTRIBUTE_VALUE
1   | 1         | noise             | meow
2   | 1         | legs              | 4
3   | 1         | has_fur           | TRUE
4   | 2         | noise             | woof
5   | 2         | legs              | 4
6   | 3         | noise             | croak
7   | 3         | legs              | 2
8   | 3         | has_fur           | FALSE
...
QUERY RESULT
ID  | ANIMAL    | NOISE   | LEGS  | HAS_FUR 
1   | CAT       | meow    | 4     | TRUE
2   | DOG       | woof    | 4     | NULL
3   | FROG      | croak   | 2     | FALSE
How would I do this? To reiterate, it's important that all the columns are there even if one Animal doesn't have that attribute, such as "DOG" and "HAS_FUR" in this example. If it doesn't have the attribute, it should just be null.
 
    