I would like to combine queries programatically to create a query resulting in all requirements satisfied. I can see there is a union and ++ operator, but I see no "intersection" or **.
Assuming Slick FirstExample, let us have a code:
val notCheap = coffees.filter(_.price>8.0)
val notExpensive = coffees.filter(_.price<9.0)
val midprice = coffees.filter(_.price>8.0).filter(_.price<9.0)
println("Midprice coffees:")
midprice foreach { case (name, supID, price, sales, total) =>
println(" " + name + "\t" + supID + "\t" + price + "\t" + sales + "\t" + total)
}
How can create notCheap
, notExpensive
and midprice
so that midprice
is created from notCheap
and notExpensive
to avoid code repetition?