Thanks for your help.
Now I've managed to fix it with this.

@approval = Post.where(:posts__debate_id => view, :posts__nodeview => 
> 'status', :floor => 0).join(:votes, :debate_id=>:debate_id, 
> :content=>'accept').select(:posts__content, :posts__user_id)
>

On Friday, September 21, 2012 11:00:05 PM UTC+1, Jeremy Evans wrote:
>
> On Thursday, September 20, 2012 11:59:31 PM UTC-7, desbest wrote:
>>
>>
>> The image above describes the results I want, but here's a more graphical 
>> explanation.
>>
> The reason I didn't see this originally is that Google Groups does not 
> display images by default.  In the future, please do not embed images to 
> posts, stick to plain text only or just include a link to the picture.  
>
> As I said earlier, you need to disambiguate the columns you want.  The 
> best way to do that is to explicitly list the columns to return, qualified 
> by the appropriate table name.
>
>   Post.where(:debate_id => view, :nodeview => 'status', :floor => 
> 0).join(:votes, :id=>:nodeview_id).select(:votes__debate_id, :votes__id, 
> ...)
>  
> Hopefully from there you can figure out how to get what you want.  If not, 
> post the exact SQL you want to use, and I'll explain how to do produce it 
> via Sequel.  If you don't know what SQL you want to use, learn SQL first.  
> Sequel is designed to make it easier to access SQL databases by producing 
> the SQL for you, but if you don't understand the underlying SQL concepts, 
> you're in for an uphill climb.
>
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/KF7k6svVtlEJ.
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/sequel-talk?hl=en.

Reply via email to