none
An item with same key has been added. RRS feed

  • Question

  • I'm trying to add my data set into my report and I keep receiving this error. I've already made alias' for my tables.

    SELECT i.fjobno as Job,
    i.ftype,
    i.fpartno,
    i.fpartrev,
    si.fcustpart,
    i.fac,
    si.manualplan,
    im.fgroup,
    im.fprodcl,
    im.fbuyer  ,
    im.fnusrqty1,
    im.fonhand,
    im.fbook,
    im.fonhand-im.fbook as OverShort,  
    ji.fdesc,
    jd.foperno,
    jp.flastoper,
    i.fstatus,
    i.fcus_id,
    sm.fcontact,
    sm.fsono,
    sm.fcustpono,
    iw.fdept,
    jd.fpro_id,
    jd.fdescnum,
    jd.fccharcode,
    i.fsono,
    ji.finumber, 
    jb.fltooling,
    jb.fbompart,
    MIN(i.ftduedate) over (Partition by jb.FBOMPART) as EarliestDate,
    i.fnusrcur1,
    i.fdusrdate1,
    i.flisapl,
    i.ftduedate ,
    i.frel_dt,
    i.fddue_date,
    sr.fduedate,
    i.fquantity,
    jd.foperqty,
    jd.fnqty_comp,
    jd.fnqty_move,
    jd.fnqty_togo,
    jd.fcomp_date,
    jd.fuprodtime,
    jd.flschedule, 
    ji.fshipqty,
    sr.fshipmake,
    row_number() over (Partition by jb.FBOMPART  Order by i.ftduedate, jb.FBOMPART, i.FPARTNO, i.FDDUE_DATE) as tempGroup
    FROM jomast i
    LEFT JOIN joitem ji ON i.fjobno=ji.fjobno 
    LEFT JOIN jopest jp ON i.fjobno=jp.fjobno 
    LEFT JOIN jodrtg jd ON i.fjobno=jd.fjobno 
    LEFT JOIN jodbom jb ON i.fjobno = jb.fjobno and 1=jb.fltooling  
    LEFT JOIN somast sm ON i.fsono =sm.fsono 
    LEFT JOIN soitem si ON ji.fsono+ji.finumber=si.fsono+si.finumber 
    LEFT JOIN sorels sr ON ji.fsono+ji.finumber+ji.fkey=sr.fsono+sr.finumber+sr.frelease 
    LEFT JOIN inmast im ON i.fpartno+i.fpartrev=im.fpartno+im.frev 
    LEFT JOIN inwork iw ON jd.fpro_id=iw.fcpro_id
    WHERE i.flisapl=0 and
    LEFT(i.fstatus,1)<>'C' and iw.fdept='02' AND jd.flschedule=1
    Order by EarliestDate, jb.FBOMPART, i.ftype, i.frel_dt
    

    Tuesday, November 27, 2018 2:33 PM

Answers

  • Hi,

    You have two columns with the same names.

    You can't have that in a dataset :

    SELECT i.fjobno asJob,i.ftype,i.fpartno,i.fpartrev,si.fcustpart,i.fac,si.manualplan,im.fgroup,im.fprodcl,im.fbuyer ,im.fnusrqty1,im.fonhand,im.fbook,im.fonhand-im.fbook asOverShort,ji.fdesc,jd.foperno,jp.flastoper,i.fstatus,i.fcus_id,sm.fcontact,sm.fsono,sm.fcustpono,iw.fdept,jd.fpro_id,jd.fdescnum,jd.fccharcode,i.fsono,ji.finumber,jb.fltooling,jb.fbompart,MIN(i.ftduedate)over (Partitionbyjb.FBOMPART)asEarliestDate,i.fnusrcur1,i.fdusrdate1,i.flisapl,i.ftduedate ,i.frel_dt,i.fddue_date,sr.fduedate,i.fquantity,jd.foperqty,jd.fnqty_comp,jd.fnqty_move,jd.fnqty_togo,jd.fcomp_date,jd.fuprodtime,jd.flschedule,ji.fshipqty,sr.fshipmake,row_number()over (Partitionbyjb.FBOMPART Orderbyi.ftduedate,jb.FBOMPART,i.FPARTNO,i.FDDUE_DATE)astempGroup FROM jomast i LEFT JOIN joitem ji ON i.fjobno=ji.fjobno LEFT JOIN jopest jp ON i.fjobno=jp.fjobno LEFT JOIN jodrtg jd ON i.fjobno=jd.fjobno LEFT JOIN jodbom jb ON i.fjobno =jb.fjobno and1=jb.fltooling LEFT JOIN somast sm ON i.fsono =sm.fsono LEFT JOIN soitem si ON ji.fsono+ji.finumber=si.fsono+si.finumber LEFT JOIN sorels sr ON ji.fsono+ji.finumber+ji.fkey=sr.fsono+sr.finumber+sr.frelease LEFT JOIN inmast im ON i.fpartno+i.fpartrev=im.fpartno+im.frev LEFT JOIN inwork iw ON jd.fpro_id=iw.fcpro_id WHERE i.flisapl=0andLEFT(i.fstatus,1)<>'C'andiw.fdept='02'AND jd.flschedule=1OrderbyEarliestDate,jb.FBOMPART,i.ftype,i.frel_dt

    You have to change the name of one of these columns with alias :

    sm.fsono AS fsono2


    Ousama EL HOR

    [If a post helps to resolve your issue, please click the "Mark as Answer"  of that post or click Answered"Vote as helpful"  button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]


     [User Page]     [MSDN Page]     [Blog]     [Linkedin]



    • Edited by Ousama EL HOR Tuesday, November 27, 2018 2:56 PM
    • Marked as answer by David9501 Tuesday, November 27, 2018 2:56 PM
    Tuesday, November 27, 2018 2:54 PM