__select count()
from ( __
__SELECT loyalty_id FROM transactions
GROUP BY loyalty_id
HAVING COUNT()>1 __
**) as t **
problem when writing the corresponding rails queries…? I am using Rails2.3.11
Also this have error **select sum(points) from transactions where transaction_type =“new_customer” or transaction_type= “review” or transaction_type= “purchase” . **
I tried like this Transaction.find(:id => :conditions =>[“transaction_type = ? OR transaction_type = ? OR transaction_type = ?”, ctype, ctype1,ctype2]).sum(“points”). but it shows some ID error
__select count()
from ( __
__SELECT loyalty_id FROM transactions
GROUP BY loyalty_id
HAVING COUNT()>1 __
**) as t **
problem when writing the corresponding rails queries…? I am using Rails2.3.11
Also this have error **select sum(points) from transactions where transaction_type =“new_customer” or transaction_type= “review” or transaction_type= “purchase” . **
I tried like this Transaction.find(:id => :conditions =>[“transaction_type = ? OR transaction_type = ? OR transaction_type = ?”, ctype, ctype1,ctype2]).sum(“points”). but it shows some ID error
that some id error refers to the :id => part. remove that and it should work
Transaction.find(:conditions =>[“transaction_type = ? OR transaction_type = ? OR transaction_type = ?”, ctype, ctype1,ctype2])
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 __
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?