These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

SQL problem getting meta-levels.

Author
Victoria Sin
Doomheim
#1 - 2013-09-19 08:16:03 UTC
Somehow I've ballsed up my query. The example below fetches information for an item (Prototpe Armor EM Hardener I), except it gives me a NULL for the meta level. Some items do have a meta-level that seems correct. I'm pretty sure this particular item (16359) should be meta-4.

Can anyone (Steve! hehe) spot my error? This is SQL Server by the way, not MySQL.

SELECT invTypes.typeID AS ID,
invTypes.groupID AS ID_Group,
invTypes.typeName AS Name,
invTypes.[description] AS [Description],
invTypes.mass AS Mass,
invTypes.volume AS Volume,
invTypes.capacity AS Capacity,
invTypes.portionSize AS Portion,
invTypes.raceID AS Race,
invTypes.marketGroupID AS MarketGroup,
(SELECT dgmTypeAttributes.valueFloat
FROM
dgmTypeAttributes
WHERE
dgmTypeAttributes.typeID = invTypes.typeID
AND
dgmTypeAttributes.attributeID = 633
) AS MetaLevel,
(SELECT invMetaTypes.parentTypeID
FROM
invMetaTypes
WHERE
invMetaTypes.typeID = invTypes.typeID
) AS ParentType
FROM
invTypes
WHERE
invTypes.published = 1
AND
invTypes.typeID = 16359 -- Prototpe Armor EM Hardener I
Victoria Sin
Doomheim
#2 - 2013-09-19 08:38:35 UTC
I've got it. My old favourite COALESCE(dgmTypeAttributes.valueFloat , dgmTypeAttributes.valueInt) :). Works now. Bear