Rabu, 28 Maret 2012

[MS_AccessPros] help changing query

 

I have the following query:

INSERT INTO sdtemp ( [schedule id], [shift date], [patient id], [sdetail id], arrival, departure, private, insrcd )
SELECT sdetail.[schedule id], Schedule.[shift date], sdetail.[patient id], sdetail.[sdetail id], sdetail.arrival, sdetail.departure, sdetail.private, Patient.insrcd
FROM Patient RIGHT JOIN (Schedule RIGHT JOIN sdetail ON Schedule.[schedule id] = sdetail.[schedule id]) ON Patient.[patient id] = sdetail.[patient id]
WHERE (((Schedule.[shift date]) Between [Forms]![Billing]![bill from] And [Forms]![Billing]![bill to]) AND ((sdetail.private)=True) AND ((Schedule.generated)=True) AND ((Patient.[hold billing])="N") AND ((sdetail.billed)=False) AND ((sdetail.attended)=True) AND ((sdetail.hold)=False))
ORDER BY Schedule.[shift date], sdetail.[patient id];

I would like to make the following change: I have in the 'patient' table a field for everyday of the week, sunday,monday etc that is true or false. If the 'schedule.shift date' which is a short date field dd/mm/yyyy is not a true field in the patient table , then i dont want to add it to the sdtemp table. for example if the shift date is 3/27/2012 which is a Wednesday and Wednesday in the patient table is false and the field insrcd is not empty, I dont want to insert into SDTEMP.

Can I do this as part of the above query ?? If yes, how?

As always all help is greatly appreciated.

Thanks

Sarah

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar