I have a multiple table query that looks something like:
SELECT tree.name, tree.type, branch.name, branch.type, leaf.name, leaf.type
FROM tree, branch, leaf
WHERE leaf.branch_id = branch.id
AND branch.tree_id = tree.id
ORDER by field(tree.type, 'Poplar', 'Birch', 'Hazelnut')
So this gives me all leaf entries that belong to any of the three tree entries.
Now, I would really only like to return the leaf entries that belong to ONE tree, in the order specified.
So if there are leaf entries belonging to a Poplar tree, only display these. However, if there are no Poplar leaf entries, only display leaf entries belonging to the Birch tree.
There could be any number of leaf entries. I just want the ones on a tree that appears in my priority list. Ideally just using one query.
Any ideas? Thanks in advance....