complex sql handling : case statements, string functions, analytic functions
Closed this issue · 2 comments
need to write/create sqls with all the possible complex constructs in a single/same sql.
Example as follows:
select distinct
cast(NULL as string) as c1
,case when t1.c2 is null then lower(trim(t2.c1)) else lower(trim(t1.c2)) end as c2
,regexp_replace(t2.c2,"^0+","") as c3
,t2.c4 as c4
,cast(NULL as string) as c4
,from_unixtime(unix_timestamp(t4.c6,'dd/MMM/yyyy'),'yyyy-MM-dd') as c5
from
db.t21 t2
left outer join db.t1 on
lower(TRIM(t1.c1)) = lower('XYZS') AND
lower(TRIM(t2.c1)) = lower(TRIM(t1.c1))
left outer join
(select ---------------------)
max(case when c1 = 'value' then c1 end) as c1 from db.t1
do we have relevant scenarios covered in json-sql-builder2?
does it support all these?
Awiating response!
Thanks!
lower(trim(tbl.column))
distinct cast(NULL as string) as column
from_unixtime(unix_timestamp(column,'dd/MMM/yyyy'),'yyyy-MM-dd')
See #35