Hey, not sure where else to post this...
I'm trying to group together a sql table that looks something like this:
PHP Code:
a_userID | b_userID | val
1 | 2 | 30
2 | 1 | 22
1 | 3 | 47
... such that I can get the SUM(val) of rows where a_userID=1 and b_userID=2 and vice versa. This is at the top of a massive query that I don't want to run twice or group further, so my thought was to generate a partner key for 1+2 which would be the same key as for 2+1, but would be unique to just that combination of partners... I'm somehow tongue-tied trying to express this more clearly...
There must be some simple equation that can generate a unique number for any two number combinations ............right? Or is that a completely daft question? For some reason this has me stumped.