# Query problem

**URL:** <https://www.ruby-forum.com/t/query-problem/127908>\
**Category:** Rails\
**Created:** [February 2, 2008, 2:54pm UTC](https://www.ruby-forum.com/t/query-problem/127908 "2008-02-02T14:54:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [February 2, 2008, 2:54pm UTC](https://www.ruby-forum.com/t/query-problem/127908/1 "2008-02-02T14:54:40Z")

</div>

Hi all,

I have users (has many) accounts

I want to show all users and the account (if he has one) of a certain  
type.

How can I query all users and if the user has a specific account, the  
account. If I do :conditions =\> :accounts.type = ‘type’ I only get the  
users with an account. I also want the users without an account.

Someone has an idea how to solve this?

Thanks  
Stijn
