-
INSERT INTO #temp
SELECT person_id, appt_dt
FROM recall
WHERE appt_dt > getdate()
UNION
SELECT person_id, appt_dt
FROM appointment
WHERE appt_dt > getdate()
SELECT person_id, min(appt_dt)
FROM #temp
GROUP BY person_id
this would give you the next appointment for a person. Not super efficient, but it would work.
PS I think you need to fix the logic to get it to work correctly.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|