• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HBM query help

 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I need help with the following query....

Code:
-------------------------------------------------------------------------------
select distinct queue
from Queue queue
join queue.queueSongRequestLookups queueLookup
where queueLookup.songRequest.songRequestStatusType = ?
-----------------------------------------------------------------------------


Basically here we have 3 tables; Queue , songRequest, and queueSongRequestLookup. There is a many to many relationship between Queue and songRequest so queueSongRequestLookup is the lookup table.

Now what I want is only the Queues that have all songRequests with songRequestStatusType as 11.

The query above does get me the Queues that have songRequests with songRequestStatusType as 11 but it also returns Queues that have songRequestStatusType other than 11. Basically if there is even one songRequest with Status of 11 this query will return it. This is not what I need. I need all the songRequests in that Queuet have status of 11, only then should it be returned.

Anyone have any suggestions?

Thanks in advance for any help.

[ November 05, 2008: Message edited by: Jehan Jaleel ]
[ November 05, 2008: Message edited by: Jehan Jaleel ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic