Hello,

Query Over in NH 3.0 is great but currently I can't handle one problem
- I don't know how to rewrite simple SQL query which returns only
distinct values from intersection table.

Let's say that I have movies database and intersection table called
MoviesOnCDs which contains 3 columns:

id - PK
id_movie - FK to movies table
id_cd - FK to cds table

Now I want to have a list with distinct movie ids from this table.
Easy huh?

<sql>

select distinct id_movie from moviesOnCds

</sql>

How to rewrite this using .QueryOver?

I have ended with this, but it doesn't return unique results:

<nh>
var moviesOnCDs =
    QueryOver.Of<MovieOnCd>()
            .Select(fnp => fnp.Movie.id);
</nh>
--
Regards,
 Macko

-- 
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.

Reply via email to