我对以下观点有疑问。以下是代码。
select
pe.project_id
,pe.project_evenement_id
,pes.project_evenement_sponsor_id
,peu.project_evenement_uitgave_post_id
,pe.omschrijving
,pes.bedrag as 'project sponsor bedrag'
,peu.bedrag as 'project evenement bedrag'
from project_evenement pe
left join project_evenement_sponsor pes
on pes.project_id = pe.project_id
and pes.project_evenement_id = pe.project_evenement_id
left join project_evenement_uitgave_post peu
on peu.project_id = pe.project_id
and peu.project_evenement_id = pe.project_evenement_id
我想创建唯一的记录,但结果显示重复。有人能告诉我如何解决这个问题。我得到的记录要多得多。
I added a photo of the datamodel and output to paint a better picture of the situation
答案 0 :(得分:0)
添加",*"到SELECT(就在FROM之前)。这将显示所有列,您可以查看重复项的位置,然后调整连接条件(添加更多条件以消除重复项),或者,如果不可能,则在SELECT之后添加DISTINCT。