Sure.

> It would be easier if you showed the real query.

Select
  'False' as FSHUnknown,
  'False' as E2Unknown,
  '' as ptGnRHaFlare,
  '' as PtGnRHaSupp,
  ci.caseid as clinicCycleID,
  Case count(stim.stimulationid)
        When  Then 1
        Else 0
        End as PtUnstimulated,
  stim.labNormalFSHLevel as labFshUpLimitNormal,
  stim.maxFSHLevel as ptMaxFshLevel,
  stim.labNormalE2Level as labE2UpLimitNormal,
  stim.maxE2Level as ptMaxE2Level,
  Case stim.clomiphenedose
        When  Then
        When NULL Then 0
        Else 1
        End AS ptClomiphene,
  stim.clomiphenedose as ptClomipheneDosage,
  Case stim.fshTotalIU
        When  Then 0
        When NULL Then 0
        Else 1
        End As PtFSH,
  stim.fshTotalIU as ptFSHDosage,
  stim.gnrhagonistid,
  gnrh.gnrhagonisttypename,
  Case stim.GNRHAntagonistDays
        When  Then 0
        When NULL Then 0
        Else 1
        End as PtGnRHA_Antagonist,
  Case
        (Select count(etp.etprocedureid) from eTransferProtocolLink etp Where
etp.protocolid = 12 and etp.etProcedureid = et.etProcedureid)
        When  then 0
        When NULL then 0
        Else 1
        End as transGIFT,
  Case
        (Select count(etp.etprocedureid) from eTransferProtocolLink etp Where
etp.protocolid IN (19,13) and etp.etProcedureid = et.etProcedureid)
        When  then 0
        When NULL then 0
        Else 1
        End as transZIFT,
  Case
        (Select count(etp.etprocedureid) from eTransferProtocolLink etp Where
etp.protocolid NOT IN (19,13,12,6) and etp.etProcedureid =
et.etProcedureid)
        When  then 0
        When NULL then 0
        Else 1
        End as transIVF,
  Case et.AHPERFORMED
        When 'None' Then 1
        When 'Some' Then 2
        When 'All' Then 3
        Else 0
        End as AZHid,
  et.treatmentAsIntended as asIntended,
  Case count(et.etprocedureid)
        When  Then 0
        When null Then 0
        Else 1
        End as transferAttempted,
  et.proceduredate
from caseInfo ci
  Left Outer Join stimulation stim on ci.caseid = stim.caseid
  Left Outer join gnrhagonisttype gnrh on stim.gnrhagonisttypeid =
gnrh.gnrhagonisttypeid
  Left Outer Join etProcedure et on ci.caseID = et.caseid
  Left Outer Join eTransferProtocolLink etp on et.etProcedureID =
etp.etProcedureID
Where
  ci.caseid IN (#session.sartdata.cycles.cyclespk#)
Group By
  ci.caseid,
  stim.labNormalFSHLevel,
  stim.maxFSHLevel,
  stim.labNormalE2Level,
  stim.maxE2Level,
  stim.clomiphenedose,
  stim.fshTotalIU,
  stim.gnrhagonistid,
  gnrh.gnrhagonisttypename,
  stim.GNRHAntagonistDays,
  et.etProcedureID,
  et.AHPERFORMED,
  et.treatmentAsIntended,
  et.proceduredate


> Which produces these results:
>
> CaseID   |   GIFT
> -------------------
>  76              0
>  77              1
>  78              0
>  78              1
>
> I need to modify the query so that instead of seeing two rows with caseid
> = 78, I see one row and a GIFT column = 1.  Or:
>
> CaseID   |   GIFT
> -------------------
>  76              0
>  77              1
>  78              1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to