Hi guys,
I'm hoping to do a query like this:
select content.Id
from {0}View content
join content.Tags tags
where (content.Id != :itemId) and tags.Name in (:tags)
group by content
having count(tags) > 0
order by count(tags) desc, content.PublishedDate desc
I don't care whether it's HQL, Linq, Criteria... so long as the SQL is
efficient (and basically the direct equivalent of the above). However, I
keep hitting issues with this.
1. You can't use "group by [entity]" - because it doesn't expand the
fields in entity. I can't specify them manually, because the specific view
I'm querying changes, and besides I don't want to specify the 20 or so
fields to return a correct entity.
2. I can't use a subquery like "SELECT content FROM {0}View content WHERE
content.ID in (...)" because you lose the implicit ordering on the query.
And I can't specify a "TOP"/"LIMIT" clause on the subquery.
3. I can't use Criteria because it doesn't support "HAVING"
So I'm kinda lost as to what to try next, short of querying and storing the
IDs in memory, and then hitting the database a second time?
Many thanks for your help,
James
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.