我的表结构:
Lantern
Lantern_type
Location
Loan
Borrower
我的查询返回重复项,我正在寻找不包含重复数据的解决方案。
代码
SELECT
l.lantern_id, l.lantern_name, l.lantern_state,lt.lantern_type,
lt.lantern_type_description, lt.lantern_type_tech_info,
lt.lantern_type_lens, lo.location_id, lo.location_name, loa.loan_id,
loa.loan_start_date, loa.loan_end_date, b.borrower_id, b.borrower_name, b.user_id
FROM lantern as l
INNER JOIN lantern_type as lt
ON l.lantern_id = lt.lantern_type_id
INNER JOIN location as lo
ON lt.LANTERN_TYPE_ID = l.lantern_id
INNER JOIN loan as loa
ON lo.LOCATION_ID = loa.LOAN_ID
INNER JOIN borrower as b
ON loa.loan_id = b.borrower_id
;