Hey again :) I have a situation where the query created is missing an "AND" resulting in invalid sql. Here is the sql that's generated:
SELECT DISTINCT t0.allow_backorder, t0.allow_multiples, t0.business_unit, t0.buy_amount, t0.customer_choice, t0.end_date, t0.get_amount, t0.hidden, t0.internal_notes, t0.key_code_required, t0.manufacturer_fulfillment, t0.offer_name, t0.priority, t0.promo_id, t0.promo_type, t0.start_date FROM marketing.dbo.promotion_master t0 JOIN marketing.dbo.promotion_key_code_detail t1 ON t0.promo_id = t1.promo_id WHERE ( ( t0.business_unit = ? ) AND ( t0.start_date <= ? ) AND ( t0.end_date > ? ) AND ( t0.key_code_required = ? ) AND t0.promo_type IN ( ?) ) ( t1.key_code = ? ) [bind: 1->business_unit:'SP', 2->start_date:2019-05-01T17:57:19.123333333, 3->end_date:2019-05-01T17:57:19.123333333, 4->key_code_required:'true', 5->promo_type:'BUY ANY GET Y', 6->key_code:'EDLP10'] Here is the sql it should generate: SELECT DISTINCT t0.allow_backorder, t0.allow_multiples, t0.business_unit, t0.buy_amount, t0.customer_choice, t0.end_date, t0.get_amount, t0.hidden, t0.internal_notes, t0.key_code_required, t0.manufacturer_fulfillment, t0.offer_name, t0.priority, t0.promo_id, t0.promo_type, t0.start_date FROM marketing.dbo.promotion_master t0 JOIN marketing.dbo.promotion_key_code_detail t1 ON t0.promo_id = t1.promo_id WHERE ( ( t0.business_unit = ? ) AND ( t0.start_date <= ? ) AND ( t0.end_date > ? ) AND ( t0.key_code_required = ? ) AND t0.promo_type IN ( ?) ) *AND* ( t1.key_code = ? ) [bind: 1->business_unit:'SP', 2->start_date:2019-05-01T17:57:19.123333333, 3->end_date:2019-05-01T17:57:19.123333333, 4->key_code_required:'true', 5->promo_type:'BUY ANY GET Y', 6->key_code:'EDLP10'] Thoughts? Thanks, Lon
