Results 1 to 2 of 2
  1. #1
    ramindya is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    20

    SQL doubt SELECT within same table ?

    I have three tables:

    tblPatient (MRN, Name ) (Primary key is MRN )
    tblPatientStudy (ID, MRN, STUDYID, Eligible) (Primary key is ID)
    tbltracking (ID, MRN, STUDYID, STATUS, Tracking date) ( Primary key is ID)

    A patient can be in any number of studies and each study has status.
    MRN is unique Medical record number for a patient
    Studyid values are 1 to 10


    Studystatus = 1 to 5
    Eligible = Yes or No

    tblpatient is linked to tblPatientStudy ( one to many relation )
    tblpatient is linked to tbltracking ( one to many relation )

    Doubt/question:
    If I input a particular STUDYID it should pull all the patients who are enrolled in that particular study and also all other studies that particular patient is enrolled and its status ( study status )
    Please provide me a SQL query that will address the above.

    I am using MS ACCESS 2010 and this query will be used behind the report.Thanks in advance !

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    A Patient can be enrolled in 1 or more Studys
    There are 10 possible Studys
    Each Patient has a Status related to each Study in which he/she is enrolled

    I see these tables:

    Patient ----------->PatientStudy<-------------------Study

    Table PatientStudy would include a field PatientStudy Status and Statuses would be in a Lookup Table.

    I have no idea what Eligible represents, and I'm not sure if you are really asking a question.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. doubt with MoveLast
    By fabiobarreto10 in forum Forms
    Replies: 8
    Last Post: 04-11-2012, 12:41 PM
  2. VBA code syntac doubt "Before Insert"
    By ramindya in forum Programming
    Replies: 1
    Last Post: 02-12-2012, 07:52 PM
  3. Replies: 1
    Last Post: 06-08-2011, 04:43 AM
  4. SELECT INTO variable table name
    By Ian P in forum Queries
    Replies: 2
    Last Post: 05-29-2010, 12:49 AM
  5. Replies: 2
    Last Post: 03-14-2010, 07:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums