mysql - SQL Syntax using CONCAT -
mysql - SQL Syntax using CONCAT -
i have table t1 fields
id,key_id ,name,date etc..
id
auto incrementing field key_id
value obtained id prefix/id prefix
constant rows , id changes id corresponding row.. it looks this
$sql = " alter table t1 auto_increment = 1234567890, add together id bigint not null primary key auto_increment "; update t1 set key_id = concat('12.345','/',id)
now due reasons want create new table t2 parent of t1 , id primary key t2 , key_id become primary key of t1. t2 should include other 2 fields key_id , name..
ok main reason parent table : might create table t3 have id , id should have different values t1 , t3 want maintain master table has id primary key , other kid tables fetch ids master table..
how can this?
why want store redundant info in column "key_id"?
since prefix constant, id enough. perform concatenation in code.
also, way, can have id primary key both tables , key_id prefixing "prefix".
mysql sql sql-update
Comments
Post a Comment