I have the following db.
If I select * and join all the tables, desc and active will be mixed up.
Now I can write all like omc_courses.desc, omc_trainer.desc etc, but if I have many field, it is not practical.
So I am thinking if I can write like
select *, omc_courses.desc AS course_desc, omc_trainer.desc AS trainer_desc,
etc for fields which has the same name.
Or is there any way you can suggest?
Thanks in advance.
CREATE TABLE IF NOT EXISTS `omc_courses` (
`id` int(11) NOT NULL AUTO_INCREMENT,
...
`desc` varchar(255) DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
...
PRIMARY KEY (`id`)
) ... ;
CREATE TABLE IF NOT EXISTS `omc_trainer` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
...
`desc` varchar(255) DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
...
PRIMARY KEY (`id`)
) ... ;
CREATE TABLE IF NOT EXISTS `omc_anothertable` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
...
`desc` varchar(255) DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
...
PRIMARY KEY (`id`)
) ... ;