sheltermanager

Open full view…

Code question

kayde1
Tue, 30 Jul 2019 13:26:22 GMT

Below is part of the code to a quick reference guide we send to our adoption centers for which animal is there and a little info about them. All of our animals are in foster which is why we use a.displaylocation. Now I am being asked to add the cell phone number of the foster person to the same section as the display location so its looks like (Foster: Mary Jane (000) 000 - 0000) Is there any way to add to this using the existing code? select a.AnimalName, sx.Sex as SexName, a.DISPLAYLOCATION, (SELECT ad.VALUE FROM additional ad INNER JOIN additionalfield af ON af.ID = ad.AdditionalFieldID WHERE ad.LinkID = a.ID AND af.FieldName = 'CatDependency') AS CatDependency, a.AnimalAge, case when a.Neutered = 1 then 'Yes' else 'No' end as NeuteredName, a.AnimalComments, (SELECT Name FROM lksynun WHERE ID = a.IsGoodWithCats) AS IsGoodWithCatsName, (SELECT Name FROM lksynun WHERE ID = a.IsGoodWithDogs) AS I sGoodWithDogsName, (SELECT Name FROM lksynun WHERE ID = a.IsGoodWithChildren) AS IsGoodWithChildrenName, sp.SpeciesName from animal a

KarenW
Tue, 30 Jul 2019 13:59:46 GMT

Add to the bottom SELECT section: owner.ownername, owner.mobiletelephone Add right below your "from animal a" LEFT OUTER JOIN adoption ON adoption.ID = a.ActiveMovementID LEFT OUTER JOIN owner ON owner.ID = adoption.OwnerID

kayde1
Tue, 30 Jul 2019 14:21:19 GMT

Didn't seem to work adding those two lines below from animal a Here is the complete code as it stands now and it didnt add the phone number :( select a.AnimalName, sx.Sex as SexName, a.DISPLAYLOCATION, (SELECT ad.VALUE FROM additional ad INNER JOIN additionalfield af ON af.ID = ad.AdditionalFieldID WHERE ad.LinkID = a.ID AND af.FieldName = 'CatDependency') AS CatDependency, a.AnimalAge, case when a.Neutered = 1 then 'Yes' else 'No' end as NeuteredName, a.AnimalComments, (SELECT Name FROM lksynun WHERE ID = a.IsGoodWithCats) AS IsGoodWithCatsName, (SELECT Name FROM lksynun WHERE ID = a.IsGoodWithDogs) AS IsGoodWithDogsName, (SELECT Name FROM lksynun WHERE ID = a.IsGoodWithChildren) AS IsGoodWithChildrenName, sp.SpeciesName from animal a LEFT OUTER JOIN adoption ON adoption.ID = a.ActiveMovementID LEFT OUTER JOIN owner ON owner.ID = adoption.OwnerID left join lksize sz on a.Size = sz.ID left join lksex sx on a.Sex = sx.ID left join species sp on a.SpeciesID = sp.ID WHERE a.AdditionalFlags like '%Sayreville%' and IsNotAvailableForAdoption = 0 and Archived = 0 order by SpeciesName, AnimalName

kayde1
Tue, 30 Jul 2019 15:54:08 GMT

Nevermind! I think i got it thanks