jason,
you will need to join in the user table and adjust your grouping
accordingly. somthing like:
count = db.users_tags.id.count()
query = db((db.users_tags.user != auth.user.id)& #\/-- isn't
that the join?
(db.users_tags.tag.belongs(db(db.users_tags.use
I still can't get the user's information out of this query.
How would I do that?
BR,
Jason
On 04/15/2011 06:22 AM, Jason Brower wrote:
Actually I think the correct way is
(db.users_tags.user != auth.user.id
Because I want all possible users but me. I am still learning this,
but I think that's
Actually I think the correct way is
(db.users_tags.user != auth.user.id
Because I want all possible users but me. I am still learning this, but
I think that's what it does.
BR,
Jason
On 04/14/2011 09:06 PM, Massimo Di Pierro wrote:
I think you want
(db.users_tags.user != db.auth_user.id)
in
I think you want
(db.users_tags.user != db.auth_user.id)
instead of
(db.users_tags.user != auth.user.id
On Apr 14, 12:05 pm, Jason Brower wrote:
> On 04/14/2011 08:46 AM, ron_m wrote:> The _select is a nested select - the
> one in the second half of the
> > WHERE clause that Christian wrote o
On 04/14/2011 08:46 AM, ron_m wrote:
The _select is a nested select - the one in the second half of the
WHERE clause that Christian wrote out for the SQL equivalent.
But the _select needs to return exactly one column, try changing
_select() to _select(db.user_tags.tag)
There is some discussi
The _select is a nested select - the one in the second half of the WHERE
clause that Christian wrote out for the SQL equivalent.
But the _select needs to return exactly one column, try changing _select()
to _select(db.user_tags.tag)
There is some discussion in the manual under the belongs topic
I made it fit my tables better:
count = db.users_tags.id.count()
query = db((db.users_tags.user != auth.user.id) & #<--- that is a join
(db.users_tags.tag.belongs(db(db.users_tags.user==auth.user.id)._select(
#<--- I thought select was only used at the end when you do
untested but...
If i where to write raw SQL, i think this is what you are asking for (where
auth.user.id==42):
SELECT ut.user, count(*)
FROM users_tags ut
WHERE ut.user != 42
AND ut.tag IN (SELECT tag FROM user_tags WHERE user=42)
GROUP BY ut.user
ORDER BY count(*)
and i think this transl
Like this?
http://web2py.com/book/default/chapter/06?search=distinct#Grouping-and-Counting
9 matches
Mail list logo