John Thomas
Posts: 0
Joined: Mon Sep 10, 2012 5:53 am

How can I construct Query joins?

I would like the user to see a list of other users they are connected with. To do this I created a Friends collection that maps the objectids from Users as userId and friendId. How do I display the names of each friend instead of the objectId? In other words, how do I do a query that joins two collections? I'm used to T-SQL where this is simply done. I'd hate to have to go back and hit the server one friend at a time to retrieve each name, when I really want something like this:

SELECT _objectId, name
FROM Users
WHERE _objectId IN
(SELECT _friendId FROM Friends WHERE userId = @myObjectId)
ORDER BY name

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

How can I construct Query joins?

Hello! There is no option to do it on server side yet. You can get Friends and Users collections and match them using JS.

RichardGolko
Posts: 0
Joined: Thu Oct 25, 2012 11:25 pm

How can I construct Query joins?

Gosh this is a pretty basic requirement for databases! Hope something come along quick!

Return to “Issues”