Skip to Content
0
Jul 02, 2020 at 09:45 AM

how to use substring function in SQL join condition?

6157 Views

I want to write a SQL which join the cosp_bak and csks table. The join condition is last 12 digits of cosp_bak 's objnr equal csks's kostl. So I wrote a SQL like

 select csks~kostl,cosp_bak~kstar into  @data(t_result) from csks left join cosp_bak on csks~kostl = cosp_bak~objnr+10(12).

and it has error

Unknown column name "OBJNR+10(12)". until runtime, you cannot specify a field list.

So what's the correct way to use function in SQL condition?Thx.