>Which looks to do what I want, apart from not returning the
configuration
>that starts just before the first DateTimeAdded in ImportData.
Are you only looking for the single, most recent Configuration that
existed before the first DateTimeAdded in ImportData?
If so, you could just go
select ConfigurationID, StartDate
from Configuration
where StartDate = (
select Max(StartDate)
from Configuration, ImportData
where StartDate < DateTimeAdded
and FilterResult <> 2 AND DateTimeAdded IS NOT NULL AND Val IS NOT
NULL)
Is that what you wanted?
Carl Reynolds Ph: +64-9-4154790
CJN Technologies Ltd. Fax: +64-9-4154791
[EMAIL PROTECTED] DDI: +64-9-4154795
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/
> -----Original Message-----
> From: Mark Derricutt [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, October 01, 1999 3:57 PM
> To: Multiple recipients of list database
> Subject: [DUG-DB]: SELECT FIRST/LAST ... again
>
> I think I've asked this before, and I think the answer was "oracle
> only"... but is there a way to select only the first/last record that
> matches your query?
>
> I have the following query:
>
> SELECT
> ConfigurationID, StartDate
> FROM
> Configuration C
> WHERE
> C.StartDate
> BETWEEN
> (
> SELECT
> MIN(DateTimeAdded)
> FROM
> ImportData
> WHERE
> FilterResult <> 2 AND DateTimeAdded IS NOT NULL AND Val IS NOT
> NULL
> ) AND (
> SELECT
> MAX(DateTimeAdded)
> FROM
> ImportData
> WHERE
> FilterResult <> 2 AND DateTimeAdded IS NOT NULL AND Val IS NOT
> NULL
> )
> ORDER BY
> StartDate
>
> Which looks to do what I want, apart from not returning the
> configuration
> that starts just before the first DateTimeAdded in ImportData.
>
> Is there anyway I can do this in one SQL statement? (against a paradox
> table).
>
> Mark
>
>
>
> --
> Mark Derricutt, Software Developer
> Getting jiggy with The Tea Party - Triptych in NZ (29/9/99 - Auckland,
> NZ)
>
> ----------------------------------------------------------------------
> -----
> New Zealand Delphi Users group - Database List -
> [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
application/ms-tnef