Getting role for logisticsElectronicAddress


i have this query

select * from logisticsElectronicAddress where logisticsElectronicAddress.Type == elAddressType &&
logisticsElectronicAddress.Description == description &&
logisticsElectronicAddress.Locator != email
join dirPartyLocation
where dirPartyLocation.Party == custTable.Party &&
dirPartyLocation.Location == logisticsElectronicAddress.Location
join dirPartyLocationRole
where dirPartyLocationRole.PartyLocation == dirPartyLocation.RecId;
join logisticsLocationRole
where logisticsLocationRole.RecId == dirPartyLocationRole.LocationRole &&
logisticsLocationRole.Name == purpose;

i need to get role for logisticsElectronicAddress, what is wrong with it ? i want to filter out so i only get logistics electronic address which has role ‘Invoice’

You can get it from \Data Dictionary\Tables\LogisticsElectronicAddressRole

Please elaborate, if you are looking for something else.