1

I'm battling with an E-SQL query where one of my fields in the a list. My problem is how do I get this to be flattened. My query is as below:

select value d from
(select (
     select value tagEntry from x.application.applicantIssues as tagEntry where
     tagEntry.issueid=x.issueid and tagEntry.issueEntryId>x.minId
) as allTags
from (select issueId,application,count(1) as count,min(tag.issueentryid) as minId
from ApplicantIssues as tag 
where !tag.rectified
group by tag.issueid,tag.application having count(1)>1
) as x) as d

The issue is that each record in the output is a list of ApplicantIssue instead of each record being just an ApplicantIssue.

I tried using flatten on d using something like

select flatten(d) from

but it gave the error:

The FLATTEN argument must be a collection of collections. Near simple identifier, line 1, column 16.

I could have achieved this with SelectMany which I thought the FLATTEN method is for but it appears I'm not using it right.

Any assistance will be appreciated.

In any case, if it is about what the query is for, it is to select all records in the group skipping the very first item.

I'm using EntityFramework 4.3

ritcoder
  • 3,274
  • 10
  • 42
  • 62
  • I ended up rewriting the esql so that there will be no need for what I want to do above. I'm leaving the question opened as I'm still very much interested in how this can be achieved in ESQL. – ritcoder Mar 24 '13 at 00:51

0 Answers0