2010-05-26 8 views

risposta

22

Basta usare il nuovo metodo select query.

Error.select('DISTINCT type') 
1

Se si cerca di ottenere una serie distinta di rendimento nei confronti di un database PostgreSQL, è necessario utilizzare:

Error.select('DISTINCT ON(type)') 

e se il vostro nel contesto di un ambito, forse qualcosa di simile a quanto segue per garantire che ottieni tutti i campi:

scope :running, select('DISTINCT ON(campaigns.budget) campaigns.*') 
+0

Error.select ('tipo DISTINCT') ha funzionato per me su postgres. –

Problemi correlati