Thanks - That worked fine for the query.

would still like to refine the stored procedure - I could alter "NOW"  to 
"TODAY"  but for now having the exact time there is useful as we are 
debugging when the stored procedure actually ran.

John


>A bit long, but it might give you some more ideas:
>
> Select
> Extract(Year from Snapshop_Date),
> Extract(Month from Snapshop_Date),
> Extract(Day from Snapshop_Date),
> Extract(Hour from Snapshop_Date),
> Extract(Minute from Snapshop_Date),
> Extract(Second from Snapshop_Date),
> Count...
> Group By 1, 2, 3, 4, 5, 6
>
> Mind you... this will still have a problem if the millisecond delay 
> bridges a second boundary, that is, it starts at the very end of a 
> second...
>
> So maybe like you mention, grab the 'now' into a var first, and use that 
> might be the best way to go...
>
> Regards
> Colin
>
>
>
>
> On 19/11/2009, at 1:23 PM, Todd Martin wrote:
>
>> Only store the date to the closest second, rather than millisecond.
>>
>>> Is there a way to write a query which groups together slightly 
>>> differeing
>>> times - the current query is
>>>
>>> Select  Snapshot_date, Count(Table1.Snapshot_date) from Table1
>>> Group by Snapshot_Date
>>>
>>> The problem is that the table is updated by a stored procedure which is 
>>> very
>>> fast, but does take a few milliseconds to run so the Group By usually
>>> produces 2 or 3 lines.
>>>
>>> Is there either:
>>> 1 - a way to query so that the group by does not care about say a 1 
>>> second
>>> discrepancy?
>>>
>>> 2 - Or Alternatively a way to force the exact same date/time into the 
>>> stored
>>> procedure below - I guess it would mean
>>> replacing the 'NOW' parameter below with a fixed Date/Time set at the
>>> beginning of the stored procedure...
>>>
>>> In the stored procedure the code uses a subquery - simplified essence is 
>>> as
>>> below:
>>>
>>> BEGIN
>>> FOR SELECT
>>> Table2.Field1 as Param1,
>>> Table3.Field2 as Param2
>>> FROM Table2,Table3
>>>
>>> WHERE
>>> ......
>>> .......
>>> ......
>>> INTO
>>> :Param1,
>>> :Param2
>>>
>>> DO
>>> BEGIN
>>> Select
>>> Insert into Table1
>>> (Field1,
>>> Field2,
>>> Snapshot_date)
>>> VALUES
>>> (:param1,
>>> :Param2,
>>> 'NOW')
>>> END
>>>
>>> SUSPEND
>>>
>>>
>>> John
>>> John Bird
>>> JBCL
>>> Contact:
>>> [email protected]
>>> 03-3844527,  027 4844528
>>> http://jbclnz.googlepages.com
>>> http://www.jbcl.co.nz
>>> ----- Original Message ----- 
>>> From: "PDS - John" <[email protected]>
>>> To: "'NZ Borland Developers Group - Offtopic List'"
>>> <[email protected]>
>>> Sent: Wednesday, November 11, 2009 4:15 PM
>>> Subject: Re: [DUG-Offtopic] Small favour
>>>
>>>
>>>> Hi Peter
>>>>
>>>> I would be interested too what others think about this issue, so please 
>>>> do
>>>> NOT response offlist, thanks:)
>>>>
>>>> This issue is similar to mine on the DUG list "Re: [DUG] HELP! : 
>>>> Windows7
>>>> 64
>>>> bits - Delphi install issues".
>>>>
>>>> John
>>>>
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From: [email protected] [mailto:offtopic-
>>>>> [email protected]] On Behalf Of Peter Hyde
>>>>> Sent: Wednesday, 11 November 2009 3:40 p.m.
>>>>> To: [email protected]
>>>>> Subject: [DUG-Offtopic] Small favour
>>>>>
>>>>> Hi there,
>>>>>  I wonder, is anyone out there running Win7/64 bit and has time to
>>>>> do a brief install/runs check for me?
>>>>>
>>>>> Virtual chocolate fish for the first response. Or a TurboNote+
>>>>> product licence, whichever you prefer <g>.
>>>>>
>>>>> Please respond offlist, thanks!
>>>>>
>>>>> cheers,
>>>>> peter
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> NZ Borland Developers Group Offtopic mailing list
>>>>> Post: [email protected]
>>>>> Admin: http://delphi.org.nz/mailman/listinfo/offtopic
>>>>> Unsubscribe: send an email to [email protected]
>>>>> with Subject: unsubscribe
>>>>
>>>> _______________________________________________
>>>> NZ Borland Developers Group Offtopic mailing list
>>>> Post: [email protected]
>>>> Admin: http://delphi.org.nz/mailman/listinfo/offtopic
>>>> Unsubscribe: send an email to [email protected] 
>>>> with
>>>> Subject: unsubscribe
>>>
>>>
>>> _______________________________________________
>>> NZ Borland Developers Group Offtopic mailing list
>>> Post: [email protected]
>>> Admin: http://delphi.org.nz/mailman/listinfo/offtopic
>>> Unsubscribe: send an email to [email protected] 
>>> with Subject: unsubscribe
>>>
>>
>> _______________________________________________
>> NZ Borland Developers Group Offtopic mailing list
>> Post: [email protected]
>> Admin: http://delphi.org.nz/mailman/listinfo/offtopic
>> Unsubscribe: send an email to [email protected] with 
>> Subject: unsubscribe
>
> #####################################################################################
>
> Attention:
>
> The information in this email and in any attachments is confidential. If 
> you are not
> the intended recipient then please do not distribute, copy or use this 
> information.
> Please notify us immediately by return email and then delete the message 
> from your
> computer. Any views or opinions presented are solely those of the author.
>
> ####################################################################################
>
> _______________________________________________
> NZ Borland Developers Group Offtopic mailing list
> Post: [email protected]
> Admin: http://delphi.org.nz/mailman/listinfo/offtopic
> Unsubscribe: send an email to [email protected] with 
> Subject: unsubscribe 


_______________________________________________
NZ Borland Developers Group Offtopic mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/offtopic
Unsubscribe: send an email to [email protected] with 
Subject: unsubscribe

Reply via email to