Note that there are some explanatory texts on larger screens.

plurals
  1. POEsqueleto `selectDistinct` not working
    primarykey
    data
    text
    <p><code>selectDistinct</code> seems to not be working for me, it's probably a simple error. the query:</p> <pre><code> info &lt;- runDB $ E.selectDistinct $ E.from $ \(tp `E.InnerJoin` rnd `E.InnerJoin` h) -&gt; do E.on (rnd E.^. RoundId E.==. h E.^. HoleRound) E.on (tp E.^. TpartTournament E.==. rnd E.^. RoundTourn) E.where_ ((tp E.^. TpartTournament E.==. E.val tId )) E.orderBy [E.asc (tp E.^. TpartId)] return (tp, rnd, h) </code></pre> <p>I'm quite sure that this represents the sql query which works:</p> <pre><code>SELECT DISTINCT tpart.id, round.name, hole.hole_num, hole.score from tpart inner join round on round.tourn = tpart.tournament inner join hole on hole.round = round.id where tpart.tournament = 1; </code></pre> <p>To view the results I have a test handler to just print the result table. Notice that for tpart 1, round 1, there are multiple hole 1 and hole 2. In postgresql <code>SELECT DISTINICT</code> removed these duplicates.</p> <pre><code> TpartId, RoundName, holeNum, HoleScore Key {unKey = PersistInt64 1}, round 1, 1, 6 Key {unKey = PersistInt64 1}, round 1, 2, 4 Key {unKey = PersistInt64 1}, round 1, 1, 6 Key {unKey = PersistInt64 1}, round 1, 2, 4 Key {unKey = PersistInt64 1}, round 1, 1, 6 Key {unKey = PersistInt64 1}, round 1, 2, 4 Key {unKey = PersistInt64 1}, round 2, 1, 3 Key {unKey = PersistInt64 1}, round 2, 2, 5 Key {unKey = PersistInt64 1}, round 2, 1, 3 Key {unKey = PersistInt64 1}, round 2, 2, 5 Key {unKey = PersistInt64 1}, round 2, 1, 3 Key {unKey = PersistInt64 1}, round 2, 2, 5 Key {unKey = PersistInt64 3}, round 1, 1, 6 Key {unKey = PersistInt64 3}, round 1, 2, 4 Key {unKey = PersistInt64 3}, round 1, 1, 6 Key {unKey = PersistInt64 3}, round 1, 2, 4 Key {unKey = PersistInt64 3}, round 1, 1, 6 Key {unKey = PersistInt64 3}, round 1, 2, 4 Key {unKey = PersistInt64 3}, round 2, 1, 3 Key {unKey = PersistInt64 3}, round 2, 2, 5 Key {unKey = PersistInt64 3}, round 2, 1, 3 Key {unKey = PersistInt64 3}, round 2, 2, 5 Key {unKey = PersistInt64 3}, round 2, 1, 3 Key {unKey = PersistInt64 3}, round 2, 2, 5 </code></pre> <p>Sorry for the illegibility. Any help would be appreciated! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload