Right now I am facing a query that I think which could be optimized.
select i.itemID,
(select image from imagetable where imageType = 1 and itemID = i.itemID)
(select image from imagetable where imageType = 2 and itemID = i.itemID)
(select image from imagetable where imageType = 5 and itemID = i.itemID)
from
item i
where
i.itemID = 3
This is a sample of what needs to be optimized, the thing is that the result is being consumed by java as a single row. and I need to include even more subqueries if I want to include more "image types".
So the question is, how can I optimize this?