Question

Photo of Dillan Cagnetta

0

How Campus Attributes linked to Campus in Database

Hi

does anyone know How Campus Attributes linked to Campus in Database?

I need to access the campus attributes i created

thanks

  • Photo of David Leigh

    0

    Dillan,

    Here is some SQL that should get you what you need:

    SELECT e.*, av.Value AS 'Attribute Value'
    FROM AttributeValue av
    INNER JOIN Attribute a ON av.AttributeId = a.Id
    INNER JOIN EntityType et ON a.EntityTypeId = et.Id
    INNER JOIN Campus e ON av.EntityId = e.Id
    WHERE et.Name = 'Rock.Model.Campus'
    AND a.Name = '{Your Attribute Name}'
    AND av.Value = '{Your Attribute Value}'

    Just replace '{Your Attribute Name}' with the Name (not the key!) of your Attribute, and '{Your Attribute Value}' as the text representation of the value you are looking for.
    If you want to be more accurate with your filter, you can replace the reference to av.Value with one of the av.ValueAsDateTime or av.ValueAsNumeric fields from the AttributeValue table.

    Hope this helps!