Skip to Content
0
Jun 16, 2021 at 09:03 AM

SQL query with join table COVJ and CSKS not working

68 Views

I 'm writing a query which query from tables COVJ and CSKS. I think the link of these two tables is COVJ's objnr substring 7 to 12 equal CSKS~KOSTL. So I write SQL below

select csks~prctr, covj~wkg001 from covj left outer join csks on substring( covj~objnr , 7, 6 ) = csks~kostl.

But it return no result in csks. I guess because CSKS~KOSTL is 10 characters.

So I tried

select csks~prctr, covj~wkg001 from covj left outer join csks on concat( '0000',substring( covj~objnr , 7, 6 ) ) = csks~kostl.

But it's also not working? So how to use substring or what's the right link between these two tables? Thx.