I have a sqlalchemy.select function, where I'm giving columns and whereclause. Here in whereclause, I need to give a subquery.
import sqlalchemy as sa
sa.column(ID) == s.query(sa.func.max(sa.select(sa.column(ID)).sa.select_from("LEADS_CREDIT_FACILITY"))).filter(sa.column(DELETED_ON) == None),
in this code, i need to give the tablename along with the column
this is my sqlquery:
`SELECT * FROM mca1_uat2.leads_credit_facility WHERE id = (SELECT max(id) FROM mca1_uat2.leads_credit_facilityw WHERE lead_id = 48887 AND deleted_on IS NULL AND '2018-12-05' BETWEEN start_date AND IF NULL(end_date,now()) group by lead_id);`
Thanks in advance.
Comments
Post a Comment