SELECT words.id, words.definition FROM stock JOIN languages ON (stock.languageID = languages.id) JOIN stockmatch ON (stockmatch.stockID = stocks.id) JOIN words ON (stockmatch.wordID = words.word_id) JOIN types ON (words.typeID = types.id) WHERE stock.word = :stock_word AND language.name = :language_name AND type.name = :type_name