Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002
    Posts
    19

    Unanswered: SQL code not selecting properly *** IGNORE THIS a mistake

    Code:
    select HospitalID,
           Max(Active) as Active,
           Max(Name) as Name,
           Max(Type) as Type,
           Max(Sex) as Sex,
           Max(Age) as Age,
           Max(Attending) as Attending,
           Max(Location) as Location,
           Max(AdmDate) as AdmDate,
           Max(LOS) as Los,
           Max(Service) as Service
           
     from 
    
    (Select * from vwNET_InPatientList
           UNION
    Select * from vwNET_ActiveList Where Active='JTALLAJ')
    
      AS q
    
    Group by HospitalID
    I get results from the above code, but where the record comes from BOTH ActivePatient AND InPatientList there are blanks in the record where there should be information.

    ActiveList is initialized to ' ' (a space, not a '') so I thought that Max would pull the information.

    Code:
    View vwNet_ActiveList
           AS
    Select Person.PersonID as HospitalID,
           Person.Name,
           Person.Type,
           Person.Sex,
           DateDiff(year,person.BirthDate,GetDate()) as Age,
           ' ' As Attending,
           ' ' As Location,
           ' ' As AdmDate,
           ' ' AS LOS,
           ' ' As Service,
           PtList.ProviderCode as Active FROM Person 
           Inner JOIN PTList ON Person.PersonID = PtList.PersonID
    above is the ActiveList.

    What stupid thing am I doing?
    Last edited by DerFarm; 04-09-03 at 12:00.
    DerFarm
    It IS as bad as you think
    and they ARE out to get you

  2. #2
    Join Date
    Nov 2002
    Posts
    19

    Ignore this thread, It's working

    turns out it's just a very rare event. I tried to delete the post, but the silly thing won't let me.

    Sorry
    DerFarm
    It IS as bad as you think
    and they ARE out to get you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •