Answer the question
In order to leave comments, you need to log in
How to select only those records that are written in another table?
Hello, here are my tables:
1) projects - A table that stores projects
id
title
src_id
created_at
2) images - and here all project images are stored.
id
project_id
src
size
How to select from the table -- only those records from `images` that were recorded in the `projects` table (src_id serves as an identifier for selection) ?
Answer the question
In order to leave comments, you need to log in
src_id serves as an identifier for the fetch
project_id
?SELECT images.*
FROM images INNER JOIN projects
ON images.project_id = projects.id
WHERE projects.id IS NOT NULL
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question