All pastes #822457 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-12-18 19:10 UTC
rendered paste body
account_balance

id  |  user_id  | balance
-------------------------
1   |   1       |  10
2   |   2       |  5
3   |   3       |  30


proposals

prop_id | user_id  | sales_id
-------------------------------
  1     |   2	   |   3
  2     |   2      |   2
  3     |   1      |   2
  4     |   3      |   2


What I want to return is ONLY 1 sales_id per user_id in the account_balance table

So something like this

account_balance.user_id  | sales_id
------------------------------------
        1                |  2
        2                |  3 ( or 2  doesn't matter)
        3                |  2