• Without a lot of information, I guess you could do something like this.

    SELECT distinct BO.NMDOS,

    CASE WHEN FT.FNO = MIN(FT.FNO) OVER(PARTITION BY BO.NMDOS) THEN bo.ETOTALDEB END AS ETOTALDEB ,

    bo.tpdesc ,

    bo.dataobra,

    BO.NOME ,

    BO.OBRANO,

    ft.nmdoc,

    FT.FNO,

    CASE WHEN FT.NDOC<> 1

    THEN 0

    ELSE FT.ETTILIQ

    END as etiliquido

    FROM BO left JOIN BI ON bi.bostamp=bo.bostamp left JOIN FI ON fi.bistamp=bi.bistamp

    left JOIN FT ON FT.FTSTAMP=FI.FTSTAMP WHERE BO.ndos='18' and bo.fechada=0

    GROUP BY BO.NMDOS,bo.DATAOBRA,BO.NOME,BO.OBRANO,BI.OBRANO,FT.FNO,FT.ETTILIQ,bo.tpdesc ,ft.nmdoc,bo.ETOTALDEB,ft.ndoc

    order by bo.DATAOBRA

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2