SELECT
		dtypes.label AS title,
		dtypes.id,
		dregions.name_short AS region,
		dregions.id AS regions_id,
		dregions.tax_applicable AS tax,
		dregions.tax_inc,

		IF(rrc.free_del_over IS NOT NULL,rrc.free_del_over,rc.free_del_over) AS 'free_del_over',

		drates.price,
		dtypes.fuel_excise,
		dtypes.type,
		dtimes.days
		FROM del_rates_rates drates
		LEFT JOIN del_rates dtypes
		ON drates.del_rates_id = dtypes.id

		LEFT JOIN del_rates_regions dregions
		ON drates.del_rates_regions_id = dregions.id

		LEFT JOIN del_rates_regions_currencies AS rc
		ON dregions.id = rc.del_rates_regions_id AND rc.currencies_id = '26'

		LEFT JOIN del_rates_times dtimes
		ON (dtypes.id = dtimes.del_rates_id AND dregions.id = dtimes.del_rates_regions_id)

		LEFT JOIN del_rates_regions_rates AS dregionsrates
		ON dregions.id = dregionsrates.del_rates_regions_id AND dtypes.id = dregionsrates.del_rates_id

		LEFT JOIN del_rates_regions_rates_currencies AS rrc
		ON dregionsrates.del_rates_regions_id = rrc.del_rates_regions_id AND dregionsrates.del_rates_id = rrc.del_rates_id AND rrc.currencies_id = '26'

		WHERE
		drates.del_rates_parcels_id = 65
		AND dtypes.online = 'yes'

		ORDER BY dtypes.sort_order,dregions.sort_order