Re: find earliest, by date, record in a table?
Re: find earliest, by date, record in a table?
- Subject: Re: find earliest, by date, record in a table?
- From: Hugi Thordarson <email@hidden>
- Date: Tue, 17 Aug 2010 16:38:09 +0000
Hi Baiss.
If you're using Wonder:
NSTimestamp t = ERXEOControlUtilities.aggregateTimestampWithQualifier( ec, "TheEntityName", "theAttributeName", "min", null );
If you're using plain ol' WO:
NSArray<NSDictionary<String,NSTimestamp>> a = EOUtilities.rawRowsForSQL( ec, "TheEOModelName", "select min(THE_COLUMN_NAME) from THE_TABLE_NAME", new NSArray<String>( "someKey" ) );
NSTimestamp t = a.objectAtIndex( 0 ).objectForKey( "someKey" );
If you're lucky, you might be able to just create a regular fetch specification and setFetchLimit( 1 ). For some DBs, this will generate an SQL statement with LIMIT, but unfortunately I have no idea which WO DB Plugins support this. You can try it though.
- hugi
On 17.8.2010, at 15:25, Baiss Eric Magnusson wrote:
> Does anyone know a SQL EOUtilities generation that would yield the earliest record.
>
> How can I create a search criteria that will return the earliest record in a table ( the records are time stamped with a date, not the creation date but the occurrence date ), without returning a sort of all the records in the table?
>
>
> ----
> Baiss Eric Magnusson
> CascadeWebDesign.com
>
>
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden