I am trying to use sql, for example:
SELECT t.*, t2.* FROM templates t
LEFT JOIN IF(t.t_type = 0,'templates_email',
IF(t.t_type = 1,'templates_sms','templates_fax')) t2
ON t.t_id = t2.t_id;
Is it possible to do something like this?
Basically I want to join one of the three tables based on the value from the row.
Is this recommended if possible?
updatesobasically a table templatesis a table containing all the information that each template should have, for example, name, identifier, description
then you have tables templates_x, these tables contain fields that are unique to each type of template.
(There is a lot of availability of one table with zero fields for those that are not applicable, it is impractical).
Tables are named templates_x, but the corresponding x is stored in the template table as an int flag.
templates_x templates t_id.
, ?