SELECT distinct(SDMS_OrganiseUnit.OrganiseUnitName), DisplayIndex,ParentOrganiseUnitID,SDMS_OrganiseUnit.OrganiseUnitID,ShortName ,DikeName FROM SDMS_OrganiseUnit left join FMDS_Water_DikeProject on SDMS_OrganiseUnit.OrganiseUnitID=FMDS_Water_DikeProject.OrganiseUnitID WHERE OrganiseUnitModel=1 AND OrganiseUnitType=3 AND SDMS_OrganiseUnit.IsDelete=0 ORDER BY DisplayIndex
想根据OrganiseUnitName去重,而且还要查询跟多的
FMDS_Water_DikeProject 里的列,还要增加链接表查询,sql怎么写?
不想重复的列丢掉,因为要算合计
OW_NUMBER() over(partition by ID order by ID) pid