So if the father is null use mother for person1fields and/or if mother is null use father for person1fields. BUT if both are NULL, use either ParGuar_3_custodialParent or Parguar_4_custodialParent fields; of using the same substr function like the mother/father field.
I am having trouble writing the statement.... if the father field is null then use the mother field. But as you can see, I also need to take the mother/father field and split in to two fields (Person1LastName andPerson1FirstName)
SUBSTR (s.father, 1, INSTR(s.father, ',', 1, 1) -1) as Person1LastName,
SUBSTR (s.father, (INSTR(s.father, ',', 1, 1)+1)) as Person1FirstName,
SUBSTR (s.mother, 1, INSTR(s.mother, ',', 1, 1) -1) as Person1LastName,
SUBSTR (s.mother, (INSTR(s.mother, ',', 1, 1)+1)) as Person1FirstName,