php - Select unique from all columns into a single column -
i have 4 columns setup have same type of data . want create table unique entries entries in columns.
c1 (name1) c2 (name2) c3 (name3) r1 r1 c1 (john) r1 c2 (tiny tim) r1 c3 (big sally) r2 r2 c1 (big sally) r2 c2 (john) r2 c3 (paul) r3 r3 c1 (tiny tim) r3 c2 (paul) r3 c3 (rajesh) r4 r4 c1 (normal ned) r4 c2 (big sally) r4 c3 (normal ned)
this need
c1 r1 john r2 big sally r3 tiny tim r4 normal ned r5 rajesh r6 paul
you can using union keyword.
select c1 table union select c2 table union select c3 table;
the results ask.
then values , insert on new table or use insert ... select insert quickly.
Comments
Post a Comment