Subject | Re: [firebird-support] Order of Non Order By Records |
---|---|
Author | Helen Borrie |
Post date | 2006-03-05T04:11:27Z |
At 02:51 PM 5/03/2006, you wrote:
providing anything that allows the rows to be selected on the basis
of "age", all the rows with identical date and time will be in
unpredictable order within their date and time grouping.
whether it is or not.
then use a timestamp column, use the 'NOW' context variable (not
CURRENT_TIMESTAMP) and pass it through the UDF GetExactTimestamp from
FbUDF to store the timestamp with 10,000ths of a second accuracy,
e.g., in your trigger
new.MyTimeStamp = GetExactTimestamp(cast('NOW' as timestamp));
Then, when you retrieve them out, use
ORDER BY MyTimestamp
./heLen
>I have a table that is ordered by a date and a time field. The usersNo, it returns them in the requested order. Since you are not
>do not enter the date and time, but they do fill in other information
>on the record. As they do, and after I refresh the view, records with
>the same date and time sometimes seem to be returned in a different
>order.
>
>Is it possible that Firebird is returning the records is a different
>order since it has no instructions to the contrary?
providing anything that allows the rows to be selected on the basis
of "age", all the rows with identical date and time will be in
unpredictable order within their date and time grouping.
>Do I need toOnly if MyRecordID is accurate for determining "age". Only you know
>include the record ID in the "order by" to stop this? For example,
>ORDER BY MyDate,MyTime,MyRecordID?
whether it is or not.
> Is there a better way?If you want accuracy based on the time when the row was *posted*,
then use a timestamp column, use the 'NOW' context variable (not
CURRENT_TIMESTAMP) and pass it through the UDF GetExactTimestamp from
FbUDF to store the timestamp with 10,000ths of a second accuracy,
e.g., in your trigger
new.MyTimeStamp = GetExactTimestamp(cast('NOW' as timestamp));
Then, when you retrieve them out, use
ORDER BY MyTimestamp
./heLen