-1

I am trying to make a notification list that displays notifications from multiple different content types and there respective database tables.for each content type There is a subscribe table with the respective subscriptions which I need to retrieve.the tables and there respective subscriptions tables are as follows

    --------------------------
    content type | subscriptions
    -------------+------------
     group       | subscribegroup
    -------------+------------
     discussion  | subscribediscussion
    -------------+------------
     forum       | subscribeforum
    -------------+------------
     thread      | subscribethread
    -------------+------------

The problem I have is that each content subscription table has a different name for the id of its values eg

enter image description here

This is how I would get the data from one content a single table with its respective subscription table and then use UNION but isnt union heavy on the database server??

  SELECT *
FROM thread t
JOIN subscribethread s ON (t.threadid = s.threadid)
WHERE userid= $currentuserid

How would I join multiple instances of other content types above with this? Thanks

Shadow
  • 33,525
  • 10
  • 51
  • 64
Malcolm
  • 23
  • 6

1 Answers1

0

We use JOIN when we need combine columns from few tables INTO ONE(or more) row. As i understand you need combine ROWS FROM DIFFERENT TABLES in one result table. There is no UNION alternative with such schemas structure.

Vitaly
  • 31
  • 3