Could not select GET_REC_NUM: Unknown column 'prop_rex.flex_bkg_terms' in 'field list' SQL USED: SELECT DISTINCT acc.ID AS rec_id, acc.Featured AS exclusive, prop_rex.flex_bkg_terms AS flex_bkg_terms, acc.new_listing AS is_new, acc.ShowOnSite AS show_on_site, acc.IsPrivate AS is_private, #BRK00 #JOIN00 IF(ofrz.ID IS NULL OR ofrz.ID = 0, 0, 1) as has_offer, IF(lstmnz.ID IS NULL OR lstmnz.ID = 0, 0, 1) as has_lastminute, #CONT00 acc.InfoText AS license_info, acc.AccommType AS acc_typ_code, acc.prop_location AS location_id, acc.AccommName_EN AS acc_name, acc.first_img AS img_filename, acc.Alias AS alias, acc.DescText_Short_EN AS short_desc, acc.BedNum AS num_bed, acc.BathNum AS num_bath, acc.SleepNum AS num_sleep, acc.rate_cur AS rate_cur, acc.rate_lo AS rate_lo, acc.rate_hi AS rate_hi, acc.rate_ny_cur AS rate_ny_cur, acc.rate_ny_lo AS rate_ny_lo, acc.rate_ny_hi AS rate_ny_hi, # acc.ls_rate_lo AS ls_rate_lo, acc.ls_rate_hi AS ls_rate_hi, acc.ls_rate_lo_ny AS ls_rate_lo_ny, acc.ls_rate_hi_ny AS ls_rate_hi_ny, # prop_typ.alias AS prop_typ, loc_0.loc_name AS prop_loc_0, loc_0.alias AS prop_loc_0_alias, loc_0.parent_id AS prop_loc_0_parent, loc_1.loc_name AS prop_loc_1, loc_1.alias AS prop_loc_1_alias, AS prop_loc_1_parent, loc_2.loc_name AS prop_loc_2, loc_2.alias AS prop_loc_2_alias, #BRK01 #JOIN01 # # OFFERS 0 IF(ofrz.offer_count IS NULL, 0, ofrz.offer_count) as offer_count, IF(ofrz.offers IS NULL,'',ofrz.offers) as offers, #JOIN03 # # LSTMINZ 0 IF(lstmnz.lastminute_count IS NULL, 0, lstmnz.lastminute_count) as lastminute_count, IF(lstmnz.lastminute IS NULL,'',lstmnz.lastminute) as lastminute FROM sbcomdb.Accommodation AS acc LEFT JOIN sbcomdb.Resorts AS rsrt ON (rsrt.ID = acc.ResortID) INNER JOIN sbcomdb.taxonomy AS prop_typ ON (prop_typ.tax_typ='prop_typ' AND INNER JOIN sbcomdb.prop_lox AS loc_0 ON ( = acc.prop_location) INNER JOIN sbcomdb.prop_lox AS loc_1 ON ( = loc_0.parent_id) LEFT JOIN sbcomdb.prop_lox AS loc_2 ON ( = loc_1.parent_id) LEFT JOIN ( SELECT ID, AssocID, Discount, #GROUP_CONCAT(DATE_FORMAT(av_deals.ArrDate,'%M'),'-', DATE_FORMAT(av_deals.DepDate,'%M'),'-',CAST(av_deals.Discount AS CHAR) ORDER BY av_deals.ID ASC SEPARATOR '#') AS offers, GROUP_CONCAT(DATE_FORMAT(av_deals.ArrDate,'%Y-%m-%d'),':', DATE_FORMAT(av_deals.DepDate,'%Y-%m-%d'),':',CAST(av_deals.Discount AS CHAR) ORDER BY av_deals.ID ASC SEPARATOR '#') AS offers, COUNT(DISTINCT av_deals.ID) AS offer_count FROM sbcomdb.av_deals AS av_deals WHERE av_deals.Exp>='2021-03-02' ##exp0 #GRPBY-2 GROUP BY av_deals.AssocID ) AS ofrz ON ofrz.AssocID = acc.ID LEFT JOIN #LSTMINZ 0 ( SELECT ID, AssocID, Discount, #GROUP_CONCAT(DATE_FORMAT(av_lastminute.ArrDate,'%M'),'-', DATE_FORMAT(av_lastminute.DepDate,'%M'),'-',CAST(av_lastminute.Discount AS CHAR) ORDER BY av_lastminute.ID ASC SEPARATOR '#') AS lastminute, GROUP_CONCAT(DATE_FORMAT(av_lastminute.ArrDate,'%Y-%m-%d'),':', DATE_FORMAT(av_lastminute.DepDate,'%Y-%m-%d'),':',CAST(av_lastminute.Discount AS CHAR) ORDER BY av_lastminute.ID ASC SEPARATOR '#') AS lastminute, COUNT(DISTINCT av_lastminute.ID) AS lastminute_count FROM sbcomdb.av_lastminute AS av_lastminute #GRPBY-3 GROUP BY av_lastminute.AssocID ) AS lstmnz ON lstmnz.AssocID = acc.ID WHERE #0 acc.Deleted=0 AND acc.Archived=0 AND acc.ShowOnSite = 1 AND acc.IsPrivate = 0 AND acc.ResortID = 22 #GRPBY-4 GROUP BY acc.ID, ofrz.ID, lstmnz.ID ORDER BY #0 rec_id=0 DESC, acc.OrdNum_InParent ASC #0 \n\n