Hi,
try for axample,

select PK, ord(GRP_COL),COL from your_table;


Mathias

Selon Dan Bolser <[EMAIL PROTECTED]>:

>
> Hello,
>
> I have data like this
>
> PK    GRP_COL
> 1     A
> 2     A
> 3     A
> 4     B
> 5     B
> 6     B
> 7     C
> 8     C
> 9     C
>
>
> And I want to write a query to select data like this...
>
> PK    FK      GRP_COL
> 1     1       A
> 2     1       A
> 3     1       A
> 4     4       B
> 5     4       B
> 6     4       B
> 7     7       C
> 8     7       C
> 9     7       C
>
>
> Where FK is a random (or otherwise) member of PK from within the
> appropriate group given by GRP_COL. FK recreates the grouping from
> GRP_COL, but in terms of PK. I want to do this because GRP_COL is
> difficult to handle and I want to re-represent the grouping in terms of PK
> (this allows me to link data into the grouping more easily).
>
> Is there a simple way to do this?
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to