News for hackers. Stuff that matters.
Re:ArangoDB: Multi-model highly available NoSQL database by ralusek on Thursday January 17, 2019 @04:39AM (#18929527)
> Thanks, I had not thought JOINs possible on this - how would a query look?

So this is for the structure with the two columns

    reference_id: '1234',
    reference_table: 'posts'

    reference_id: '4321',
    reference_table: 'comments'
So let's say that this is the `likes` table that can like either `comments` or `posts`, here are some queries:

    // Get comments and their respective likes
    SELECT * from comments
      JOIN likes ON comments.id = likes.reference_id;

    // Get posts and their respective likes
    SELECT * from posts
      JOIN likes ON posts.id = likes.reference_id;

    // Get likes and their referenced comments
    SELECT * from likes
      JOIN comments ON comments.id = likes.reference_id;
And so on.

There are no comments on this comment yet.