Generic Method to find the tuples used for computation in Postgres?
Posted
by
Rahul
on Stack Overflow
See other posts from Stack Overflow
or by Rahul
Published on 2013-10-26T15:51:08Z
Indexed on
2013/10/26
15:53 UTC
Read the original article
Hit count: 335
sql
|postgresql
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 ?
© Stack Overflow or respective owner