Re: [mongodb-user] MongoDB equivalent of SQL JOIN

88 views
Skip to first unread message

Justin Dossey

unread,
May 22, 2012, 5:33:43 PM5/22/12
to mongod...@googlegroups.com
If you provide more information, you'll get more help.  You should be reading  http://www.mongodb.org/display/DOCS/Aggregation  though.  It's strange-- you mention SQL JOIN, but what you describe sounds more like a use case for GROUP BY. You know,
 
SELECT grade AS Case, COUNT(grade) AS Results FROM tests GROUP BY grade;

Justin Dossey



On Tue, May 22, 2012 at 6:20 AM, Stephen <sthy...@gmail.com> wrote:
Hi,

I currently have a database collection that stores tests results in
the format of Total,Passing Failures. However for statistically
reports i need to be able to create a collection that has the
following format.

Case    -  Results - ID
Total      - 200 -       1
Passing -150 -        1
Failing   - 50-          1

If I was using SQL id use a join to merge the fields together to get
the desired format but I am quite lost as to how i can approach this
with Mongo.

Any help would be great.

--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

Reply all
Reply to author
Forward
0 new messages