I've got a database table with the columns DOC1, DOC2 and CLIENT. I'm trying to select one row per CLIENT, whose DOC1 column has the highest priority based on the following order, from highest to lowest priority: ITCI > ITPP > ITPS > ITPT.
Here is an example.
INPUT
DOC1 DOC2 CLIENT
ITCI GG319 101
ITPS YB311 102
ITPT GG319 101
ITPP YB311 102
OUTPUT
The destination table should have CLIENT has unique key and I have to add the two columns DOC1 and DOC2, by taking the line which has DOC1 with the highest priority.
CLIENT DOC2 DOC1
101 GG319 ITCI
102 YB311 ITPP
I wrote a select single in end routine but there was a syntax error:
Select single doc1 doc2 (W_doc1, W_doc2)
FROM /BI0/Pdoctax
WHERE client eq <RESULT_FIELDS>-client.