{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Calibri;}} {\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang7\f0\fs22 SELECT list.* , count(DISTINCT com.id) as comments, max(ind.ind_order) + 1 as inv FROM (SELECT kll.kll_id, kll.kll_timestamp, kll.kll_external_id,\par plt.plt_name, crp.crp_name, crp.crp_id,\par ali.all_name, ali.all_id,\par kll.kll_system_id, kll.kll_ship_id,\par kll.kll_victim_id, plt.plt_externalid,\par kll.kll_crp_id, kll.kll_points, kll.kll_isk_loss,\par shp.shp_class, shp.shp_name,\par shp.shp_externalid, shp.shp_id,\par scl.scl_id, scl.scl_class, scl.scl_value,\par sys.sys_name, sys.sys_sec,\par fbplt.plt_name as fbplt_name,\par fbplt.plt_id as fbplt_id,\par fbplt.plt_externalid as fbplt_externalid,\par fbcrp.crp_name as fbcrp_name,\par fbali.all_name as fball_name,\par fbcrp.crp_id as fbcrp_id,\par fbali.all_id as fball_id FROM kb3_kills kll STRAIGHT_JOIN kb3_pilots plt\par ON ( plt.plt_id = kll.kll_victim_id )\par STRAIGHT_JOIN kb3_corps crp\par ON ( crp.crp_id = kll.kll_crp_id )\par STRAIGHT_JOIN kb3_alliances ali\par ON ( ali.all_id = kll.kll_all_id )\par STRAIGHT_JOIN kb3_pilots fbplt\par ON ( fbplt.plt_id = kll.kll_fb_plt_id )\par STRAIGHT_JOIN kb3_inv_detail fb\par ON ( fb.ind_kll_id = kll.kll_id AND fb.ind_plt_id kll.kll_fb_plt_id )\par STRAIGHT_JOIN kb3_corps fbcrp\par ON ( fbcrp.crp_id = fb.ind_crp_id )\par STRAIGHT_JOIN kb3_alliances fbali\par ON ( fbali.all_id = fb.ind_all_id )\par STRAIGHT_JOIN kb3_systems sys\par ON ( sys.sys_id = kll.kll_system_id ) STRAIGHT_JOIN kb3_ships shp\par ON ( shp.shp_id = kll.kll_ship_id )\par STRAIGHT_JOIN kb3_ship_classes scl\par \pard\ri70\sa200\sl276\slmult1 ON ( scl.scl_id = shp.shp_class ) INNER JOIN kb3_inv_all inv ON (inv.ina_kll_id = kll.kll_id)\par \pard\sa200\sl276\slmult1 WHERE inv.ina_all_id IN (462 ) AND shp.shp_class NOT IN ( 2,3,38,11 ) AND shp.shp_class IN ( 32 ) ORDER BY inv.ina_timestamp desc LIMIT 10 OFFSET 0) list JOIN kb3_inv_detail ind ON (ind.ind_kll_id = list.kll_id) LEFT JOIN kb3_comments com ON (list.kll_id = com.kll_id) GROUP BY list.kll_id ORDER BY kll_timestamp desc /* kill list */;\par }