Database error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '30' AND m.statusID < 10 GROUP BY m.modellID ORDER BY qty DESC LIMIT 0, 20' at line 16 for query

		SELECT m.modellID, m.art_no, m.familyID, m.plastID, m.markeID, m.katID, m.typID, m.editionID, m.price_type_id, m.statusID, m.statusID as artStatID, m.prioID, m.price_sek, m.price_eur, m.sale_sek, m.sale_eur, m.back_up_qty, 
		matt.model_year, matt.turn, matt.speed, matt.glide, matt.fade, matt.img_file, matt.img_file_type, matt.img_color_id, matt.diameter, matt.weight, matt.mf_link, matt.introduced, matt.updated, 
		sum(oi.qty) as qty, 
		md.modell,
		mf.family_id, mf.family, mf.fa_type_id, mf.fa_speed, mf.fa_glide, mf.fa_turn, mf.fa_fade,
		ma.marke, (mf.fa_speed + mf.fa_glide) AS distance, (mf.fa_turn + mf.fa_fade) AS direction, 
		k.kat, t.typ, t.typ_en, p.plast, p.qualityID, p.p_price_sek, p.p_price_eur
		FROM modell_family mf 
		INNER JOIN (modell m, modell_description md, modell_attributes matt, marke ma, typ t, kat k, plast p, plastic_quality pq, modell_status ms, orders o, order_items oi)
		ON (mf.family_id = m.familyID AND m.modellID = md.modellID AND m.modellID = matt.modellID AND  m.statusID = ms.statusID
		AND m.markeID = ma.markeID AND m.typID = t.typID AND m.katID = k.katID AND m.plastID = p.plastID AND p.qualityID = pq.id  
		AND oi.o_id = o.o_id AND oi.modellID = m.modellID) 
		WHERE 
		t.typID != '38' AND o.konto_id < 4 AND o.username NOT LIKE 'discsport' AND o.statusID < 10 
		AND md.language_id = '2' 
	 AND YEAR(o.o_timestamp) = '2018' AND ma.markeID = '30 AND m.markeID = '30' AND m.statusID < 10  GROUP BY m.modellID ORDER BY  qty DESC LIMIT 0, 20
in /home/discrtse/public_html/shopping/modeller.php on line 1225