Displaying 1 result from an estimated 1 matches for "beds_total".
2006 Feb 18
1
sql logic is killing me
...lity_id = ?",
        params[:facility_id] ],
      :include => [:facility, :client],
      :order_by => ''facilities.name, clients.last_name,
      :per_page => 14)
    @facility = Facility.find(:first,
      :conditions => ["id = ?", params[:facility_id] ])
    @beds_total = @facility.beds_m + @facility.beds_f + @facility.beds_a
    @beds_m_cnt = Client.count_by_sql("select count(*) " +
      " from clients where sex = ''M'' ")
  end
the @beds_m_cnt gives me count of all Male clients but I only need the
ones in @placements which I...