Hello. The problem is this: There is a staff table that stores employee accounts.
id | login | pass-----------------1 | usr | 1234
And a table with translations (lang_ru, lang_en, etc) of various entries, where the item_id contains the id c of the table that is specified in the table_name to which this translation belongs. The item_destination is the field that is being translated. In item_text - the translation itself
id | item_id | table_name | item_destination | item_text--------------------------------------------------------1 | 1 | staff | name | Василий2 | 1 | staff | position | Охранник
Is it possible in MySQL to somehow select a record from the staff table and all related records from the table with translations in one query?
My knowledge is only enough for a simple Join which will return me a couple of String from staff -> A string from lang, and for one record from the staff will display two of the lang.
Common sense dictates that it is impossible to do so, but suddenly there is something that I have not yet had time to learn in the process of learning.
Table structure
CREATE TABLE `staff` ( `id` int(11) NOT NULL AUTO_INCREMENT, `login` varchar(60) COLLATE utf8_unicode_ci NOT NULL, `pass` text COLLATE utf8_unicode_ci NOT NULL, `salt` text COLLATE utf8_unicode_ci NOT NULL, `seed` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, `access_level` int(11) DEFAULT NULL, `date_registered` int(11) DEFAULT NULL, `photo` int(11) DEFAULT NULL, `status` tinyint(1) DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `login` (`login`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci CREATE TABLE `lang_ru` ( `id` int(11) NOT NULL AUTO_INCREMENT, `table_name` text COLLATE utf8_unicode_ci NOT NULL, `item_id` int(11) NOT NULL, `item_destination` text COLLATE utf8_unicode_ci NOT NULL, `item_text` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci