Sam OZ
asked on
Oracle view to get a field value based on another row
I have an oracle table for Documents with fileds DocNo , Revision, State , Plant
Only some revisions for a given docno has the plant value
sample data
DocNo Revision State Plant
Doc1 1 1
Doc1 2 1 P1
Doc1 3 2
Doc2 1 1
Doc2 2 3 P2
I need a view with following
For rows where Plant value present return state as state * 10
For rows with no plant value , look DocNo and return plant value from the row for same DocNo with plant value
View should be like
DocNo Revision State Plant
Doc1 1 1 P1
Doc1 2 10 P1
Doc1 3 2 P1
Doc2 1 1 P2
Doc2 2 30 P2
Only some revisions for a given docno has the plant value
sample data
DocNo Revision State Plant
Doc1 1 1
Doc1 2 1 P1
Doc1 3 2
Doc2 1 1
Doc2 2 3 P2
I need a view with following
For rows where Plant value present return state as state * 10
For rows with no plant value , look DocNo and return plant value from the row for same DocNo with plant value
View should be like
DocNo Revision State Plant
Doc1 1 1 P1
Doc1 2 10 P1
Doc1 3 2 P1
Doc2 1 1 P2
Doc2 2 30 P2
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.