0

次のSQLをllblgenで動作させようとしています...

SELECT *,(SELECT TOP (1) Id FROM Content.Grades WHERE Account = Authentication.Account.Id ORDER BY Grades.GradingDate DESC) AS CurrentGrade FROM Authentication.Account WHERE (SELECT TOP (1) Grade FROM Content.Grades WHERE Account = Authentication.Account.Id ORDER BY Grades.GradingDate DESC) = 5


 var dtFields = new ResultsetFields(1);
            dtFields.DefineField(GradesFields.Id, 0);
            var dtDefinition = new DerivedTableDefinition(
                           dtFields, "c", new PredicateExpression(GradesFields.Grade == SelectedGrade.Value));

            // specify the relation which is a dynamic relation. 
            var relation = new DynamicRelation(dtDefinition, JoinHint.Inner,
                                            EntityType.GradesEntity, "o",
                                           (new EntityField2(AccountFields.Id.ToString(), "c", typeof(string)) ==
                                            GradesFields.Account.SetObjectAlias("o")));

            RelationBucket.Relations.Add(relation);

クエリを試行するたびにフィールドでエラーが発生するため、これを合わせるのに苦労しています...

4

1 に答える 1