I'm using scala version 2.12.6 and slick version 3.2.3
I would like to join multiple tables from a postgres database with
- 1:1 relationship between description and product
- 1:0/1 relation between product and price and
- 1:n relationship between price and currency
the desired output:
(description, product, price, Seq[Option[currencies])
what I have so far:
val query = (for {
(((description, product), price), currencies) <- ((descriptions.filter(_.language === lang.locale.toLanguageTag()) join products on (_.productId === _.id)) joinLeft prices on (_._2.id === _.priceId)) joinLeft currencies on (_._2.map(_.id) === _.priceId)
} yield (description, product, price, currencies))
but this code results in
(description, product, price, [Option[currencies])
with duplicate rows