My database has 7 tables: one is the parent (feeds) and the other 3 are the children (public feeds, private feeds, generated feeds) of an isA relationship. There is a table “subscriptions” with a foreign key on the feeds table. Each user can subscribe a feed of any type. The problem is that the view for each type of feed is different, that means I need to generate different links for each type of feed subscribed. Under the current scheme I need to perform 3 queries to get the type of the feed from the feed id. Is there a better solution to this problem?
Share
You could use a view to pre-join the children to the parents, and to get a consistent result regardless of which child type. For example:
Or if your feeds table doesn’t have a feed_type column (or equivalent):