i am using this code :
SELECT MAX(user) AS lastuser, category
FROM journal
GROUP BY category
HAVING (COUNT(category) > 1)
it works but returns 1 line by category >1
i need all the user (all the rows) HAVING (COUNT(category) > 1) , not only 1
if 1 category has only 1 user i must not keep it
i am not shure to be clear :-)
thank you for helpingIf you need all the users fulfilling the requirements, why are you using the "max" argument. By its nature, the max (maximum) will return the largest value. Get rid of max, add user to your group by and try again.|||you mean
SELECT user, category
FROM journal
GROUP BY user,category
HAVING (COUNT(category) > 1)
i dont get it in that way
I dont need the lines : A|B where count(B) = 1
i need only the lines : A|B. C|B, D|B count(B) > 1
with my first code I get D|B (the last one)|||I don't think that your query will work it would return
where a user had the same category more than once
not differeent categories for the same user.
SELECT user
FROM journal
GROUP BY user
HAVING (COUNT(category) > 1)|||i dont get it in that way
i need for exemple 3 lines
john tennis
pierre tennis
paul tennis
3 lines if count(category) > 1|||SSELECT user_name,
category
FROM journal
WHERE category IN (SELECT category
FROM journal
GROUP BY category
HAVING COUNT(*) > 1)|||i'll try
thank you
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment