Reputation: 1341
I have a straightforward table hierarchy involving 4 tables;
slices -> blocks -> ribbons -> glassplate
Some logic about the above semantics:
I'm trying to construct a (postgres) query that will retrieve relevant information about ribbon(s), block and slice, using the glassplates barcode, i.e. glassplate_id.
My current query, using glassplate ID = '163'
SELECT * from slices WHERE slices.id IN
(
SELECT blocks.slice_id FROM blocks WHERE blocks.id IN
(
SELECT block_id FROM ribbons WHERE glassplate_id = 163
)
)
do return the information I need from the slices table.
Question is; how to retrieve relevant fields in the blocks and ribbons table as well, in the same query? Relevant columns in those tables would be the ones that I choose.
Upvotes: 0
Views: 31