Read here:
  http://nhforge.org/doc/nh/en/index.html#queryhql-subqueries

Something like this might work, assuming you're using an NHibernate
many-to-many.

var orphanedSongs =
   _session.CreateQuery(
      "from Song as song where song.Albums.size = 0")
      .List();

Or, if you've mapped your AlbumSongs table to a class:

var orphanedSongs =
   _session.CreateQuery(@"
    from Song as song
    where not exists (
       from AlbumSong where AlbumSong.Song = song
    )
  ")
  .List();

T





On Apr 10, 5:25 pm, parnar <[email protected]> wrote:
> hello, i'm new to nhibernate and i need some help
> i looked over the net for a solution but didnt find
> i have 3 tables, Albums, Song,AlbumSongs (Contains foreign keys: album
> id and song id)
> i have one query that give results of all the songs of the album
> i want to query all the songs that are not in a album.
> how can i do so?
>
> thank you.
--~--~---------~--~----~------------~-------~--~----~
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