node
id title content type
47 test foobar 1
type
id name
1 blog
output
id title content type
47 test foobar blog
using the following query doesn’t seem to be working…
SELECT a.id, a.title, a.content, a.type
FROM node a
WHERE a.id = '. $id .'
JOIN type b
ON
a.type = b.id
how should I write this query to get the output I want?
You are almost there. You only need to place the
WHEREcondition lastOne remark and a personal preference, but I’d like to explicitly indicate the
JOINtype to remove any doubts for people maintaining the code.