Tuesday, December 13, 2011

Re: [Rails] Sub queries problem with Active Record



On Tue, Dec 13, 2011 at 9:00 PM, amvis <vgrkrishnan@gmail.com> wrote:
Thanks for the reply..

sorry, that made a mistake when i post here. that query had't an id.  i think the problem with rails version..? am using rails2.3.11.

This is mysql query  select sum(points) from transactions where transaction_type ="new_customer" or transaction_type= "review" or transaction_type= "purchase"

and also have one sub query to convert into active record

select count(*) 
from ( 
   SELECT loyalty_id  FROM transactions 
   GROUP BY loyalty_id 
   HAVING COUNT(*)>1 

) as t 


can you post the error and the code that causes it? 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/MvkkV0K6C5IJ.

To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.



--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate