Generic Method to find the tuples used for computation in Postgres?
- by Rahul
If I have a table
col1 | name | pay
------+------------------+------
1 | Steve Jobs | 1006
2 | Mike Markkula | 1007
3 | Mike Scott | 1978
4 | John Sculley | 1983
5 | Michael Spindler | 1653
The user executes a sum query which sums the pay of people getting paid more than $1500. Is there a way to also implicitly know which tuples have been used which satisfy the condition for sum ?
I know you can separately write another query to just return the primary key ids which satisfy the condition. But, Is there any other way to do that in the same query ? probably rewrite the query in some way ? or...
any suggestion ?