🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.ruby
Article #882

Re: ORM i subquering

#882
From: Maciej Piechotka
Date: Sun, 06 Jan 2008 09:46
19 lines
1589 bytes
On Sun, 06 Jan 2008 02:41:48 +0000, Jaroslaw Zabiello wrote:

> Aby było "id IN(SELECT..." a nie "...id=(SELECT...", musisz wstawić [].
> Można to też budować w kawałkach:
> 
> sub = Post.select(:user_id).filter{:priority >=4} User.filter(:id =>
> [sub])

Jesteś pewien? Mi działa bez:

irb> User.filter(:id => Post.filter{:priority >= 4}.select(:user_id)).sql
=> "SELECT * FROM users WHERE (id IN (SELECT user_id FROM posts WHERE 
(priority >= 4)))"

Pozdrawiam
-- 
I've probably left my head... somewhere. Please wait untill I find it.
Homepage (pl_PL): http://uzytkownik.jogger.pl/
(GNU/)Linux User: #425935 (see http://counter.li.org/)
Technical Details
Message-ID: <3lk655-5ku.ln1@router.piechotka.com.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.internetia.pl!nnrpd.internetia.pl
References: <vtt455-f5d.ln1@router.piechotka.com.pl> <op.t4hlryz2r2rg33@jzmbp.local>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.internetia.pl!nnrpd.internetia.pl
From: Maciej Piechotka <uzytkownik2@gmail.com>
Newsgroups: pl.comp.lang.ruby
Subject: Re: ORM i subquering
Date: Sun, 6 Jan 2008 10:46:43 +0100
Organization: Netia S.A.
Lines: 20
Message-ID: <3lk655-5ku.ln1@router.piechotka.com.pl>
References: <vtt455-f5d.ln1@router.piechotka.com.pl> <op.t4hlryz2r2rg33@jzmbp.local>
NNTP-Posting-Host: 87-205-36-241.adsl.inetia.pl
Mime-Version: 1.0
X-Trace: mx1.internetia.pl 1199613622 8917 87.205.36.241 (6 Jan 2008 10:00:22 GMT)
X-Complaints-To: abuse@inetia.pl
NNTP-Posting-Date: Sun, 6 Jan 2008 10:00:22 +0000 (UTC)
X-Tech-Contact: usenet@internetia.pl
X-Orig-Path: router.piechotka.com.pl!news
User-Agent: Pan/0.132 (Waxed in Black)
X-Server-Info: http://www.internetia.pl/news/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit