mysql - Is it possible to create group_id using repeating text information from another column -
let's have table like
id      |   group_id    |   text    | -------------------------------------- 1       |                   |   nba -------------------------------------- 2       |                   |   nhl -------------------------------------- 3       |                   |   nba -------------------------------------- 4       |                   |   nhl -------------------------------------- 5       |                   |   nhl -------------------------------------- is possible create group_id mysql function or query or :) using fact of repeating (duplicate) text in column text ? have table that
id      |   group_id    |   text    | -------------------------------------- 1       |       10      |   nba -------------------------------------- 2       |       11      |   nhl -------------------------------------- 3       |       10      |   nba -------------------------------------- 4       |       11      |   nhl -------------------------------------- 5       |       11      |   nhl -------------------------------------- 
you try use hex function:
select id, hex(text) group_id, text tbl if want decimal value, can conver hex:
select id, conv(hex(text), 16, 10) group_id, text tbl result:
id  group_id    text 1   5128769 nba 2   5128769 nba 3   5130316 nhl 4   5130312 nhh 5   5130316 nhl 8   4342081 baa 9   4342081 baa 
Comments
Post a Comment