On 15 Oct 2008, at 10:41, inriz wrote:

>
> hello list,
>
> i'm searching for an implementation of the following sql statement:
>
> SELECT inserent.* FROM inserent
> join
> (select objpriv.maknr from objpriv
> where objpriv.bankkto like '593%' and objpriv.zahlart = 'B'
> group by objpriv.maknr) o on o.maknr = inserent.insnr
>
> ORDER BY
> inserent.AENDDATUM desc
>
> evidently, i solved my problem with
>
> @advertisers = Advertiser.paginate(   :select => "inserent.*", :order =>
> "inserent.AENDDATUM desc", :from => "inserent join (select
> objpriv.maknr from objpriv where objpriv.bankkto like '#{query}' and
> objpriv.zahlart = 'B' group by objpriv.maknr) o on o.maknr =
> inserent.insnr")
>
> but, the pagination is broken.
> i know i'm abusing the from parameter for my needs

Use the :joins parameter ?

Fred


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to