Are you using SQL? Have you considered creating a view?