> left outer join menuitem on > (coalesce(subcat.category, cat.categoryid) = menuitem.categoryid) might be fun seeing whether that's actually supported... or works as intended but i like the way you think!! ;o)