Hi there,

I need some help, after a few hours of searching drupal.org and google.com, trying the group by module(which just gave me some errors or not the desired effect) I can't seem to figure out how I could get a single row returned for every single user.
To be more specific, I have a table were all the games played within my website are stored, the table has a result and a user id ref field to the user node. I want to create some kind of highscore list and for that I need all the best results from every single user, but now it is just returning all the results, or because of the arguments settings in views2 it is returning all the results for a specific user.

I was hoping that I can achieve this with views. But I don't know how.

Thanks in advance

Comments

joecanti’s picture

ignore the grouping bits - i found they didn't help.

So i guess you have several fields in your view - eg username, game, high score, and you want them to appear like this:

User1 game1 70
User2 game1 62
User3 game1 48

For this you would select table view and put the user field into the user column, game field into the game column and score field into the score column...

By having each field in a different column, they all appear next to each other on one row.

Then you could add a sort criteria so that the highest score is at the top.

Cheers, joe

royniels’s picture

Thanks joe for your reply, but I think it won't help me, but after reading my own topic I can understand people would get confused :-)
Here is the thing, I have a list like this

User1 game1 70
User1 game1 52
User1 game1 28
User2 game1 73
User2 game1 10
User3 game1 90

What I want is this:

User1 game1 70
User2 game1 73
User3 game1 90

How can I get this done, I just want the best results for every single user in a table. Use grouping?

Cheers!

If you have a solution then I'll buy you a beer...

joecanti’s picture

Im not sure is the short answer! Some ideas....Apparently grouping could be worth exploring with the 'Views group by' module. There seems to be quite a lot of people asking how they display the latest blog from each user with only one entry from each user, and this is essentially the same. If you can find a working example of this on the forums then this would be great as you would only have to change latest blog for highest score which would be easy in views...

Secondly, if you could find some way of making a users highest score automatically sticky, or automatically flag it with the flag and actions modules, it would then be very easy to filter out all the non flagged items in views...

The arcade module might help, but may be way off the mark...

sorry i couldnt help more...you would have thought it easy to set up an argument for this in views...

god luck, joe

royniels’s picture

Well i'm just going for the flag option, I thought I could do something with the group by but the reallity is that you never know if you get the best result from the user because it will just group the results and show you the last one added to the table.

And a query with a flag set is much less complicated and probably much quicker, I'm not the expert on SQL, but I can imagine that it is faster. Thanks joe!