Skip to Content
0
Aug 19, 2016 at 01:49 PM

More concise SELECT in SQL Script

143 Views

I have a select which uses the same test for a number of fields. Is there more concise way of getting the same result?

outTab = select

case

when coord <> ' ' and prorder.prorder <> ' '

then prorder.entry

else :intab.entry

end as entry

case

when coord <> ' ' and prorder.prorder <> ' '

then prorder.auart

else :intab.auart

end as auart

left outer join proder_tab as prorder

on prorder.prorder = :intab.coord;

The idea is that if there is an matching record in table proder_tab, use the values from that, rather than the ones from :intab.

This is part of an AMDP in 7.4.