MySQL Forums
Forum List  »  Archive Storage Engine

help needed to solve the query
Posted by: Ahmed khan
Date: November 16, 2006 06:11AM

i have two table Agent and Ad

i want to select all the agents with / without ads

when i use right join the Hibernate throws exception

can anybody write an equivalent query so that i dont have to use join

here is the query

select ag.id, ag.name, ag.brokerage, count(a),
(select count(a2) from Ad a2 where a2.agent.id = ag.id and a2.adStatus ='new' or a2.adStatus= 'off market' from Ad a right join Agent ag on a.agent.id = ag.id

Thanks in advance

Options: ReplyQuote


Subject
Views
Written By
Posted
help needed to solve the query
5696
November 16, 2006 06:11AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.