Using query like:
Campaign.find_by_sql("select c.*,sc.*,org.name as org_name from campaigns as c left join super_campaigns as sc ON sc.id= c.super_campaign_id left join organisations as org ON org.id= c.organisation_id where c.status=0 AND sc.status='active'")
Getting error after using sc.status='active'.Thanks.
You can achieve that by using interpolation, here is an example from a project i made for doing something similar
As you can see
#{Ticket::HIGH}is coming fromPRIORITY = [HIGH = 'high', NORMAL = 'normal', LOW = 'low']same goes for the othersNote: this is a part of the original code.