Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sortBy with multiple columns fails #164

Closed
vilinski opened this issue Oct 13, 2015 · 4 comments
Closed

sortBy with multiple columns fails #164

vilinski opened this issue Oct 13, 2015 · 4 comments

Comments

@vilinski
Copy link

This works:

let newAnnouncements = 
    query { for n in ctx.``[dbo].[FeatureDeleteAnnouncements]`` do
            sortBy n.pg_id
            select n
    }

but this fails:

let newAnnouncements = 
    query { for n in ctx.``[dbo].[FeatureDeleteAnnouncements]`` do
            sortBy (n.pg_id,n.feature_id)
            select n
    }

with runtime error:

System.Exception: unrecognised method call
at Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation(FSharpExpr e)

at Microsoft.FSharp.Linq.QueryModule.EvalNonNestedInner(CanEliminate canElim, FSharpExpr queryProducingSequence)
at Microsoft.FSharp.Linq.QueryModule.EvalNonNestedOuter(CanEliminate canElim, FSharpExpr tm)
at Microsoft.FSharp.Linq.QueryModule.clo@1737-1.Microsoft-FSharp-Linq-ForwardDeclarations-IQueryMethods-Executea,b
at <StartupCode$FSI_0008>.$FSI_0008.main@()
Stopped due to error

or how can I do this? Also interested on outer join on multiple columns

@pezipink
Copy link
Contributor

Hi, you should be able to sort by multiple columns by including more than one sortBy or sortByDescending clauses, they will be processed in the order they are encountered.

For outer joins, the leftOuterJoin keyword is not supported as it requires us to implement groupJoin which in turns requires a bunch of other stuff that has not been done yet. If your join is between fields with foreign keys setup, you can get it to left join by using the special (!!) operator within the for.. syntax, eg for prod in (!!) table1.MyForeignKey do...

Cheers

@kmikeru
Copy link

kmikeru commented Mar 12, 2016

Is it possible to do outer join on arbitrary columns (without PK/FK)?

@Thorium
Copy link
Member

Thorium commented May 27, 2016

Original question is answered by pezipink and the second question is duplicate to #141

@Thorium
Copy link
Member

Thorium commented Jan 12, 2019

You can use thenBy to sort by multiple columns.

Is it possible to do outer join on arbitrary columns (without PK/FK)?

When this was asked it wasn't working, now it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants