Ruby on Rails Wednesday, June 27, 2012

i have one query 

@recommendations = Recommendation.select('cnames.name,max(recommendations.count)').
                  where('recommendations.skill= ?',@key).
                  order('recommendations.company_id ASC').
                  group('recommendations.company_id').
                  joins('JOIN recommendations ON cnames.id = recommendations.company_id')

when i run this query i got this error

PG::Error: ERROR:  table name "recommendations" specified more than once

Why it shows like that?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/DiHSj40If2AJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment