DB::connection('oracle') ->table('rejectevent') ->select('rejectevent.event_source as Event_Source', 'tap3countrydialcode.country_dial_code as CDC', 'rejectevent.input_attr_4 as ATTR_4', 'rejectevent.INPUT_ATTR_24 as ATTR_24') ->join('tap3roamerdata', function($join) { $join->on('substr(rejectevent.input_attr_24, 27, 14)', '=', 'tap3roamerdata.tap_reference_key') ->where('tap3roamerdata.group_key', '=', 'substr(rejectevent.input_attr_24, 6, 16)'); //This makes it a and condition }) ->join('tap3countrydialcode','substr(rejectevent.input_attr_24, 1, 5)', '=', 'tap3countrydialcode.plmn_code') ->whereIn('rejectevent.event_type_id',[8, 9, 10, 13, 17, 18, 41, 42, 43, 44, 45, 46, 47]) ->where('rejectevent.reject_status', '=', 1) ->toSql();
returns this statement
string 'select rejectevent.event_source as Event_Source, tap3countrydialcode.country_dial_code as CDC, rejectevent.input_attr_4 as ATTR_4, rejectevent.INPUT_ATTR_24 as ATTR_24 from rejectevent inner join tap3roamerdata on substr(rejectevent.input_attr_24, 27, 14) = tap3roamerdata.tap_reference_key and tap3roamerdata.group_key = ? inner join tap3countrydialcode on substr(rejectevent.input_attr_24, 1, 5) = tap3countrydialcode.plmn_code where rejectevent.event_type_id in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) and rej'... (length=538)
My issue is why its returning inner join tap3roamerdata on substr(rejectevent.input_attr_24, 27, 14) = tap3roamerdata.tap_reference_key and tap3roamerdata.group_key = ?
with a ? instead of the substr(rejectevent.input_attr_24, 6, 16)
this small issue is breaking the whole select statement
Sorry dont know how to code format the block i just pasted
Can Anyone help?
Hi Guys,
Never Mind, Resolved this myself simply by changing my Join Array from
->join('tap3roamerdata', function($join) { $join->on('substr(rejectevent.input_attr_24, 27, 14)', '=', 'tap3roamerdata.tap_reference_key') ->where('tap3roamerdata.group_key', '=', 'substr(rejectevent.input_attr_24, 6, 16)'); })
to
->join('tap3roamerdata', function($join) { $join->on('substr(rejectevent.input_attr_24, 27, 14)', '=', 'tap3roamerdata.tap_reference_key') ->on('tap3roamerdata.group_key', '=', 'substr(rejectevent.input_attr_24, 6, 16)'); })
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community