I have a PHP script that displays data like this:
Eurasia
Eurasia<sup>island</sup>
Africa
Where Eurasia and Africa are mainland parents of
ecological regions and Eurasia<sup>island</sup> is a
parent of an ecological system that is associated with
a continent. For example, Borneo would be
Eurasia<sup>island</sup>.
The finished script will display an animal species'
distribution. Obviously, I don't want to say it lives
in Eurasia Eurasia.
Instead, I want to group them together, so an Old
World species like the leopard might look like this:
Eurasia
Africa
...no matter how many ecological regions it inhabits
on either continent, mainland or island.
The problem is that when I add GROUP BY to my command,
I lose the superscripts. It appears to favor a
particular row, and if that particular row represents
a mainland ecoregion, then EVERYTHING is defined as
mainland.
My script also displays footnotes that will eventually
name the islands it's native to. These, too, disappear
when I use the GROUP BY command.
Is there a simple solution you can think of? If not,
can you think of some sort of workaround, like a
separate table listing islands that I can somehow plug
into the system? Normalization isn't a priority; what
I'm doing is already over my head, and my primary goal
is user friendly - simply coming up with something
that works.
Below are some simple diagrams of my tables. Thanks.
ANIMALS TABLE
Canis_lupus | wolf
Panthera_tigris | tiger
JOIN TABLE
SPECIES | ECOREGION
Canis_lupus | NA1008
Canis_lupus | NA1010
ECOREGIONS TABLE
ID | NAME | Geog | Geog2
NA1008 | Alaska tundra | na | na
IM1003 | Philippine rainforest | eur | phl
(Note that mainland ecoregions feature the continental
ID in each of the last two columns, while island
ecoregions feature the island's ID in the last
column.)
GEOGRAPHY TABLE
ID | NAME
na | North America
phl | Philippines
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com