Sql Statement Date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anastasiasoul
    New Member
    • Aug 2007
    • 1

    Sql Statement Date

    Patients, whose age is less than 18 when diagnosed, require parental consent to
    undergo treatment. In these cases the field, pconsent, will be flagged, y. Once their
    18th birthday has arrived this is no longer necessary.
    Give a list of patients currently admitted who are 18 or over and whose record states
    they require parental consent for treatment. When this function is executed the system
    should update the parental consent flag to n.
    I've got the qry which returns ALL patients with pconsent set to 'y', how can i see only those who are 18 or over and then update it for pconsent = 'n'?

    SELECT admision.indate , patient.nhsno, pname, dob, diagnos.adno, diagnos.pconsen t
    FROM admision, patient, diagnos
    WHERE admision.adno=d iagnos.adno And patient.nhsno=a dmision.nhsno And currentdate Between admision.indate And admision.outdat e And diagnos.pconsen t="y";
  • JKing
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    I suggest having a look at the DateDiff function and Now() function in the Access help files. Using the DOB I'm sure you can figure out how to put them together to find the age. Then it's simply a matter using the age in your where criteria.

    Comment

    Working...