Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: Slow case statement evaluation comparing values from two tables

$
0
0

Just to mention it: very good way to put the question!

If everybody would do it like this, providing answers would be a whole lot easier.

 

In case you want to improve this even further, please provide a working example next time.

Something like this:

 

create column table customers (id integer, name varchar(30))

 

insert into customers values (1, 'BLA');

insert into customers values (2, NULL);

insert into customers values (3, 'BLUPP');

insert into customers values (4, NULL);

insert into customers values (5, 'BLIP');

insert into customers values (6, 'BLOP');

 

select c1.id, c1.name as c1name, c2.name as c2name, coalesce (c1.name, c2.name)

from

    customers c1 inner join customers c2

                 on c1.id = c2.id+1

order by c1.id                

 

is already sufficient to work with your issue.

 

- Lars


Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>