조합을 사용하여 1 대 다수 관계가있는 테이블을 두 개 결합해야하지만 성공하지 못합니다. 1 대 다수 관계가있는 테이블을 레코드 1 줄로 결합하는 방법
나는
select a.equipmentid,
a.codename,
a.name,
a.labelid,
a.ACQUISITIONDATE,
a.description
from TBL_EQUIPMENTMST a where
a.partofid = '57'
union all
select first 1 b.warrantyid, b.startdate, b.enddate from tbl_equipwarranty b
inner join TBL_EQUIPMENTMST c
on b.equipmentid=c.equipmentid
where c.partofid = '57' and b.servicetype='service' order by b.warrantyid desc
union all
select first 1 d.warrantyid, d.startdate, d.enddate from tbl_equipwarranty d
inner join TBL_EQUIPMENTMST e
on d.equipmentid=e.equipmentid
where e.partofid = '57' and d.servicetype='product' order by d.warrantyid desc
이 사람이 내 이미지 내 예상 출력을 생성하는 방법 나를 도울 수이 코드를 사용하려고했습니다. 파이어 버드를 데이터베이스로 사용하고 있습니다. mysql에서 해결책을 찾았다면 친절하게도 파이어 버드에있는 답을 찾아보십시오.
두 번째 및 세 번째 검색어가 동일한 것으로 보이는 별칭을 제외하고는? – FuzzyTree
동일한 것에 대해 미안합니다. 코드에서 오류가 있지만 오류는 여전히 수정되었습니다. – Mandz