PalaniKannan K wrote in post #950423:
> I tried to find the not null elements from database
>
> @genus_counts = Table.count(:all, :conditions=> {:col1 => params[:gm],
> :col2
> => nil}, :without => {:col3 => nil})

In SQL you don't use equality to find NULL values.

SELECT * FROM my_table WHERE my_col IS NULL;
or
SELECT * FROM my_table WHERE my_col IS NOT NULL;

Rails:
:conditions => [ "col1 = ? and col2 IS NULL and col3 IS NOT NULL", 
params[:gm] ]

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en.

Reply via email to