zio-sql icon indicating copy to clipboard operation
zio-sql copied to clipboard

`in` should support sub queries that return a single column

Open bertlebee opened this issue 5 years ago • 0 comments

select * from a where a.id in (select id from b where something) is a fairly common pattern in sql which zio-sql doesn't currently support.

    val deleteFromWithSubquery = deleteFrom(orders).where(fkUserId in {
      select(userId as "id") from users where (fName === "Fred") //this should work
    })
type mismatch;
 found   : this.Read.Select[this.Features.Source,this.users.TableType,this.SelectionSet.Cons[this.users.TableType,java.util.UUID,this.SelectionSet.Empty]]
    (which expands to)  this.Read.Select[this.Features.Source,this.users.TableType,this.SelectionSet.Cons[this.users.TableType,java.util.UUID,this.SelectionSet.Empty.type]]
 required: this.Read[java.util.UUID] 

bertlebee avatar May 30 '20 01:05 bertlebee