Yesterday I screwed up by asking question which had dupe column name by accident. This caused interesting solutions. So I will ask same question here again, but this time I will directly mysql dump, so there are no confusion.
CREATE TABLE `tbl1` (
`UserID` char(15) DEFAULT NULL,
`col1` char(15) DEFAULT NULL,
`col2` char(15) DEFAULT NULL,
`col3` char(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `tbl2` (
`UserID` char(15) DEFAULT NULL,
`col4` char(15) DEFAULT NULL,
`col5` char(15) DEFAULT NULL,
`col6` char(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO tbl1
(`UserID`, `col1`, `col2`, `col3`)
VALUES
('user1', 'one', 'two', 'three');
INSERT INTO tbl1
(`UserID`, `col1`, `col2`, `col3`)
VALUES
('user1', 'oneone', 'twotwo', 'threethree');
INSERT INTO tbl2
(`UserID`, `col4`, `col5`, `col6`)
VALUES
('user1', 'col4name', 'col5name', 'col6name');
End result what I am looking for would look like this, after mysql query.
CREATE TABLE `endresult` (
`UserID` char(15) DEFAULT NULL,
`col4name` char(15) DEFAULT NULL,
`col5name` char(15) DEFAULT NULL,
`col6name` char(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
You will see that user1 has on tbl2 under col4 record "col4name" which was added by user1 for his/hers custom name for that particular column. Now I would like to see these custom column names displayed like they are displayed on "endresult" table.
I know this would be preferred to do at the end using php to display, but I really need to do this in mysql side. Thanks again