With my ongoing saga to try to do things directly in the database instead of using some php-logic, another question.
For instance: I’ve got a table: m/ id | by | msg an id, by who is this done and what is the message. The by field is an integer connected to another table which stores the name. Normally I would left join the two tables:
SELECT m.id, m.msg, user.name FROM m LEFT JOIN user ON m.by = u.id
With the resulting relation, e.g.:
1 | Hello World | Richard
2 | Foo Bar | Some else
3 | Howdy | Richard
I’m richard and have user.id=4
Is it possible to have the resulting relation to display you instead of Richard where the condition user.id = (int) is met?
1 Answer