Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Joining Tables

Author  Topic 

anishap
Yak Posting Veteran

61 Posts

Posted - 2006-04-26 : 13:15:08
I want to pull a report which will give the immunizations details of all employees by department,company who had one MMR and one Mumps or just one Mumps or one MMR.

The tables are IMMUNE,EMPLOYEE,COMP and DEPT.
IMMUNE.TYPE = '107'(MUMPS) or '108' (MMR)

EMPLOYEE.FLDREC_NUM = IMMUNE.FLDEMPLOYEE
EMPLOYEE.FLDDEPT = DEPT.FLDCODE
EMPLOYEE.FLDCOMP = COMP.FLDCODE

Can someone help me to pull a report using the above criteria?.


IMMUNE
REC_NUM long(8) Primary Key
TYPE char(6) References IMMTYPE.CODE Type of immunization
EMPLOYEE long(8) References EMPLOYEE.REC_NUM Employee
DATE date Date of immunization
MANUFACT char(6) References VACCMAN.CODE Manufacturer
LOTNUM char(20) Lot Number
STATUS char(6) References IMMSTAT.CODE Status
DOSE char(20) Dose
ADMIN char(12) References EXAM.CODE Administrator
NOTE[3] char(80) Note
EXPDATE date Vaccine Expiration Date
COST long(10,2) Cost Of Vaccine
USER1 char(40) User Field 1
USER2 char(40) User Field 2
USER3 char(40) User Field 3
USER4 char(40) User Field 4
USER5 char(40) User Field 5
USERDAT1 date User Date 1
USERDAT2 date User Date 2
USERDAT3 date User Date 3
USERDAT4 date User Date 4
USERDAT5 date User Date 5
SITE char(15)
GIVENBY char(30) Given By (free text)
VISGIVEN date Date VIS Given
VISPUBDT date VIS Publication Date
ENCOUNTR long(8) References ELOG.REC_NUM Encounter


Employee Table.
REC_NUM long(8) Primary Key
SSN char(25) SSN
ID char(25) ID
LNAME char(40) Last Name
FNAME char(40) First Name
MI char(20) Middle Initial
LASTFMI char(40) Computed Last, First MI.
SEX char(1) References GENDER.CODE Gender
SEXWORD char(6) Computed Sex Word (Male/Female)
RACE char(6) References RACE.CODE Ethnic Group
BDATE date Date of birth
HOMEPHON char(20) Home telephone #
MARITAL char(1) References MARITAL.CODE Marital Status
SHIFT char(8) References SHIFT.CODE Work shift
COMP char(12) References COMP.CODE Company code
LOC char(12) References LOC.CODE Location code
DEPT char(12) References DEPT.CODE Department code
JOB char(12) References JOB.CODE Job code
WAGEHOUR long(8,2) Wage/Hour
WAGE_DAY long(8,2) Wage per day
WAGEWEEK long(8,2) Wage/Week
HOURDAY int(4,2)) Hours / day
DAY/WEEK int(4,2)) Days/Week
UNION char(6) References UNION.CODE Union Code
ADD1 char(30) Address line 1
ADD2 char(30) Address line 2
CITY char(20) City
STATE char(4) References STATE.CODE State
ZIP char(9) Zip code
COUNTY char(20) County
CITYSTZP char(40) Computed City, State, Zip Code
MAILSTOP char(10) Mail Stop
WORKPHON char(20) Work phone
HIREDATE date Date of hire
JOBDATE date Date started current job
JOBYRS int(2) Computed Number of years on job
JOBMON int(1) Computed Number of months on job

Dept
REC_NUM long(8) Primary Key
CODE char(12)
DESCR char(40)
CLASS char(12) References DEPTCLSS.CODE
DEPTTYPE char(6) References DEPTTYPE.CODE
OLDSUPER char(6)
OSHARATE long(8,2)
OLDNSLVL int(3)
CORPCODE char(12)
EXPOSURE[100] char(6) References EXPOSURE.CODE
NOISELVL char(10)
DUSTLEVL char(10)
COMPANY char(12) References COMP.CODE
MANGNAME char(40)
MANGPHON char(10)
MANGPEXT char(5)
MANGFAX char(10)
MANGEMAL char(60)
LOCATION char(12) References LOC.CODE
INACTIVE char(1)
WORKGRP char(20) References WORKGRP.CODE
SUPER char(25) References SUPER.CODE
MONBASE long(10,2)
MONHRMUL long(10,2)

COMPANY
REC_NUM long(8) Primary Key
CODE char(12)
DESCR char(40)
ADDRESS char(40)
CITY char(20)
STATE char(2)
ZIP char(5)
PHONE char(15)
NOTE char(40)
OSHARATE long(8,2)
CONTACT char(50)
CLASS char(6) References COMPCLSS.CODE
PHONEEXT char(5)
CONTACT2 char(40)
PHONE2 char(10)
PHONE2EX char(5)
FAX char(10)
NUMEMP long(10)
MODWORK char(1)
INSCARR char(40)

   

- Advertisement -