I need to convert below sql code to pyspark data frame code not in spark.sql('code') code.
select * from table1 where
(
case when clm1 in ('R','C', 'F') then l=1
when clm1 in ('8','8-B')
and (select coalesce(max (code),0) from table2 where clm2 = "XXX') = 0 then 1=2
else 1=2 end)
How to use case condition in where condition...