three tables - articles
, galleries
, images
.
articles
has a column gallery
(integer
- id
of included gallery)
galleries
has a column images
(csv string
- ids
of included images)
images
has id
and src
columns.
Now I need to get src of images
-> included in a gallery
-> included in an article
.
I firstly select gallery id
from the table articles
Then - using the given gallery id
- select images ids
from the table galleries
Then using the given images-ids
- select the sources of images
from the table images
.
This scenario is tedious, requires a lot lot of coding.
Is there any shorter, easier way?
I cannot write img sources
or img ids
directly inside articles
because need to get changes inside articles
automatically - when a change inside galleries
or images
is done.
Any help?