Answer the question
In order to leave comments, you need to log in
Overgrown SQL... I see a problem, but I can't find a solution. Can you help?
There is a request:
$query = "SELECT `id`, `header`, `text`, `content`, `img`, (SELECT surname FROM personal WHERE id = (SELECT id_employee FROM news WHERE news.id_employee = personal.id) LIMIT 1) AS surname, `status`, `period` FROM `news`";
Answer the question
In order to leave comments, you need to log in
SELECT
news.`id`,
news.`header`,
news.`text`,
news.`content`,
news.`img`,
personal.surname,
news.`status`,
news.`period`
FROM `news`
JOIN personal ON (personal.id = news.id_employee)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question