Table CRS has two records per every record in table D, I want the field CRS.S from table CRS with sequence = 2. Table D and CRS are joined through D to A; A to AC, AC to CRS.
select id, id2, cs, bks = (SELECT crs.s
from d, A, AC, CRS
where D.id2 = A.id2
and A.AId = AC.AId
and AC.CRtId = CRS.CRId
and CRS.sequence = 2)
The subquery is returning multiple records, returning all the records in CRS with a sequence 2. How can I make it return just one record. I understand that it is return multiple records because I have not stated to return a specific record in the subquery based on decision, my questions is how.