new refine lookup sql
(non functional since apocypha, TL2MaterialsForTypeWithActivity is GONE)
SELECT
 TL2MaterialsForTypeWithActivity.activity,
 invTypes.typeName,
 TL2MaterialsForTypeWithActivity.quantity
FROM  `TL2MaterialsForTypeWithActivity` 
INNER JOIN invTypes on invTypes.typeID = TL2MaterialsForTypeWithActivity.requiredTypeID
WHERE  TL2MaterialsForTypeWithActivity.`typeID` =26073

reverse lookup sql
SELECT
 TL2MaterialsForTypeWithActivity.activity,
 invTypes.typeName,
 invTypes.typeID,
 TL2MaterialsForTypeWithActivity.quantity
FROM  `TL2MaterialsForTypeWithActivity` 
INNER JOIN invTypes on invTypes.typeID = TL2MaterialsForTypeWithActivity.typeID
WHERE  TL2MaterialsForTypeWithActivity.requiredTypeID =25595
ORDER BY invTypes.typeID

SELECT
 theitem.typeID as typeID,
 theitem.typeName as item ,
 typeReq.typeName as reqname ,
 graphics.icon as icon,
 ROUND(materials.quantity * (1 + bluePrint.wasteFactor / 100) ) AS quantity
FROM
 TL2MaterialsForTypeWithActivity AS materials
 INNER JOIN invTypes AS typeReq ON materials.requiredtypeID = typeReq.typeID
 INNER JOIN invBlueprintTypes AS bluePrint ON materials.typeID = bluePrint.blueprintTypeID
 INNER JOIN invTypes as theitem on bluePrint.productTypeID = theitem.typeID
 INNER JOIN eveGraphics AS graphics ON typeReq.graphicID = graphics.graphicID
WHERE
 materials.activity = 8 and
 typeReq.typeName like '%plas%'
ORDER BY theitem.typeName;

Ammo table
select t.typeName,
        a120.valueFloat as rangebonus,
        a114.valueInt as emdmg,
        a116.valueInt as exdmg,
        a117.valueInt as kindmg,
        a118.valueInt as thermdmg
from invTypes t
        left join dgmTypeAttributes a120 on t.typeID=a120.typeID
        left join dgmTypeAttributes a114 on t.typeID=a114.typeID
        left join dgmTypeAttributes a116 on t.typeID=a116.typeID
        left join dgmTypeAttributes a117 on t.typeID=a117.typeID
        left join dgmTypeAttributes a118 on t.typeID=a118.typeID
        inner join invGroups g on t.groupID=g.groupID
where g.groupID=85
        and a120.attributeID=120
        and a114.attributeID=114
        and a116.attributeID=116
        and a117.attributeID=117
        and a118.attributeID=118
        and t.published=1

want to fiter on charge size attribute add charsize bits.. but the result is garbage.
select t.typeName,
        a120.valueFloat as rangebonus,
        a114.valueInt as emdmg,
        a116.valueInt as exdmg,
        a117.valueInt as kindmg,
        a118.valueInt as thermdmg,
        a128.valueInt as chargesize
from invTypes t
        left join dgmTypeAttributes a120 on t.typeID=a120.typeID
        left join dgmTypeAttributes a114 on t.typeID=a114.typeID
        left join dgmTypeAttributes a116 on t.typeID=a116.typeID
        left join dgmTypeAttributes a117 on t.typeID=a117.typeID
        left join dgmTypeAttributes a118 on t.typeID=a118.typeID
        left join dgmTypeAttributes a128 on t.typeID=a128.typeID
        inner join invGroups g on t.groupID=g.groupID
where g.groupID=85
        and a120.attributeID=120
        and a114.attributeID=114
        and a116.attributeID=116
        and a117.attributeID=117
        and a118.attributeID=118
        and a128.attributeID=128
        and t.published=1
	and a128.valueInt=1
order by rangebonus

Get all attributes for all items in the samemarket group
select
 invTypes.typeName as name,
 invTypes.marketGroupID,
 dgmAttributeTypes.published,
 dgmAttributeTypes.attributeID as attributeID,
 dgmAttributeTypes.attributeName,
 dgmAttributeTypes.displayName,
 dgmTypeAttributes.valueInt,
 dgmTypeAttributes.valueFloat
from
 dgmAttributeTypes,
 dgmTypeAttributes,
 invTypes
where
 invTypes.marketGroupID=565 and
 invTypes.typeID=dgmTypeAttributes.typeID and 
 dgmTypeAttributes.attributeID=dgmAttributeTypes.attributeID
order by
 invTypes.typeName, dgmAttributeTypes.categoryID, dgmAttributeTypes.attributeId
all the stats of everything in one market group:
select
 dgmAttributeTypes.published,
 dgmAttributeTypes.attributeID as attributeID,
 invTypes.typeID,
 invTypes.groupID,
 invTypes.typeName,
 dgmAttributeTypes.attributeName,
 dgmAttributeTypes.displayName,
 dgmTypeAttributes.valueInt,
 dgmTypeAttributes.valueFloat
from
 dgmAttributeTypes,
 dgmTypeAttributes,
 invTypes
where
 dgmTypeAttributes.typeID=invTypes.typeID and
 dgmTypeAttributes.attributeID=dgmAttributeTypes.attributeID and
 invTypes.groupID = 773
order by
 dgmAttributeTypes.categoryID, dgmAttributeTypes.attributeId