database - how to insert same record in one column but different row in mysql? -
how can insert same records in 2 columns different row without duplicating 2 columns in same row ?
i have 2 tables
structure table rek
- rek int (primary key)
- name varchar (10)
- address varchar (15)
structure table cek
- cek int (primary key)
- rek int (foreign key)
- date date
table rek
rek name address 001 jane alaska 002 amel washington 003 john virginia
table cek (i output table below.)
cek rek date 01 002 12-05-2015 01 003 12-05-2015 02 002 13-05-2015 03 001 12-05-2015
how can insert in table cek if want output table cek? when trying insert data shown in above table can't. when removed primary key cek, data duplicated.
from second table cek remove primary key , fk both columns. , create composite primary key on column (cek,rek) in way in words can record in 2 columns different row without duplicating 2 columns in same row ... or else best thing create bridging table between these 2 columns
Comments
Post a Comment