Dzoukr / Dapper.FSharp

Lightweight F# extension for StackOverflow Dapper with support for MSSQL, MySQL, PostgreSQL, and SQLite
MIT License
365 stars 35 forks source link

"count" problem with inner join in v4.5.1+ #92

Closed katatunix closed 11 months ago

katatunix commented 11 months ago

I believe from v4.5.1 (and currently v4.6.0) the lib has problem with count and innerJoin. For example:

select {
    for p in table'<{| Id: string; GameId: string |}> "Players" do
    innerJoin g in table'<{| Id: string |}> "Games" on (p.GameId = g.Id)
    count "*" "Value"
} |> conn.Select<{|Value: int64|}>

I used the Deconstructor to see the raw SQL query:

SELECT `Players`.`Value` FROM `Players` INNER JOIN Games ON `Games`.`Id`=`Players`.`GameId`

Indeed the SQL query did not contain the count(*) statement.

Note:

Hope you will consider this.

Dzoukr commented 11 months ago

Oh, thanks for letting me know - will look at it!

Dzoukr commented 11 months ago

Fixed in 4.6.1, thanks to @jindraivanek ❤️