Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread SQL MAX
Wed, Apr 22 2009 4:44 AMPermanent Link

"Paul Coshott"
Hi All,

I have an SQL statement in ElevateDB that uses MAX and a sub select. How can
I do the following in DBISAM ?

SELECT
  *,
  (SELECT MAX(ContactDate)
   FROM D2DContacts
   WHERE PatientID = C.PatientID) AS LastContact
FROM
  Patients C


Thanks,
Paul

Wed, Apr 22 2009 5:36 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Paul,

Here is what you need:

SELECT
  C.*, MAX(P.ContactDate) AS LastContact
FROM
  Patients C
  LEFT OUTER JOIN D2DContacts D ON D.PatientID = C.PatientID
GROUP BY
  PatientID

--
Fernando Dias
[Team Elevate]

Wed, Apr 22 2009 7:28 PMPermanent Link

"Paul Coshott"
Hi Fernando,

thanks very much for the help.

Cheers,
Paul

"Fernando Dias" <fernandodias.removthis@easygate.com.pt> wrote in message
news:825BFA88-11EF-4565-B2A9-06621997722C@news.elevatesoft.com...
> Paul,
>
> Here is what you need:
>
> SELECT
>   C.*, MAX(P.ContactDate) AS LastContact
> FROM
>   Patients C
>   LEFT OUTER JOIN D2DContacts D ON D.PatientID = C.PatientID
> GROUP BY
>   PatientID
>
> --
> Fernando Dias
> [Team Elevate]
>

Wed, Apr 29 2009 2:31 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Paul,

<< I have an SQL statement in ElevateDB that uses MAX and a sub select. How
can I do the following in DBISAM ? >>

I knew it would happen eventually, but I think that's the first of that type
of question (EDB --> DBISAM). Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com

Image