Mark, is the 'secs' column the offset from the minimum value of the
timestamp column?

If so, you might try something like this:

SELECT UNIX_TIMESTAMP(MIN(timestamp)) INTO @min_timestamp FROM my_table;

SELECT uid, timestamp,
UNIX_TIMESTAMP(timestamp) - @min_timestamp AS secs
FROM my_table
ORDER BY 1, 2, 3;

HTH,
Dan


On Jan 8, 2008 7:17 PM, mark carson <[EMAIL PROTECTED]> wrote:

> Hi All
>
> I have the following data example
> UID   Timestamp
> 123456         20071201 12:00:01
> 123456         20071201 12:00:06
> 987654         20071201 12:00:01
> 987654         20071201 12:00:09
> etc
>
> I need :
> UID               Timestamp                     secs
> 123456         20071201 12:00:01      0000
> 123456         20071201 12:00:06      0005
> 987654         20071201 12:00:01      0000
> 987654         20071201 12:00:09      0008
>
> or similar solution. I am using version 5.0 and willing to use interim
> tables or any SQL based technique.
>
> Thanks in advance
>
> Mark
>
> --
> Mark Carson
> Managing
> Integrated  Product Intelligence CC
> EMail : [EMAIL PROTECTED]/[EMAIL PROTECTED]
> snailmail : P.O. Box 36095 Menlo Park 0102, South Africa
> Cell : +27 83 260 8515
>
>
> This e-mail may contain PRIVILEGED AND/OR CONFIDENTIAL INFORMATION
> intended
> only for use of the addressee. If you are not the addressee, or the person
> responsible for delivering it to the person addressed, you may not copy or
> deliver this to anyone else. If you received this e-mail by mistake,
> please
> do not make use of it, nor disclose it's contents to anyone. Thank you for
> notifying us immediately by return e-mail or telephone. INFORMATION
> PROVIDED
> IN THIS ELECTRONIC MAIL IS PROVIDED "AS IS" WITHOUT WARRANTY
> REPRESENTATION
> OR CONDITION OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT
> LIMITED TO CONDITIONS OR OTHER TERMS OF MERCHANTABILITY AND/OR FITNESS FOR
> A
> PARTICULAR PURPOSE. THE USER ASSUMES THE ENTIRE RISK AS TO THE ACCURACY
> AND
> THE USE OF THIS DOCUMENT.
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>

Reply via email to