From: Matt S Trout Date: Sat, 18 Aug 2012 12:25:57 +0000 (+0100) Subject: fix desc detection for genericsubq X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e31249d4af492c6a6abb37394d3cd5ad2d832c68;p=dbsrgits%2FData-Query.git fix desc detection for genericsubq --- diff --git a/lib/Data/Query/Renderer/SQL/Slice/GenericSubquery.pm b/lib/Data/Query/Renderer/SQL/Slice/GenericSubquery.pm index c01c48c..c637729 100644 --- a/lib/Data/Query/Renderer/SQL/Slice/GenericSubquery.pm +++ b/lib/Data/Query/Renderer/SQL/Slice/GenericSubquery.pm @@ -23,8 +23,11 @@ sub _render_slice { [ Operator({ 'SQL.Naive' => 'apply' }, [ Identifier('COUNT'), Identifier('*') ]) ], Where( Operator( - { 'SQL.Naive' => ($first_order->{reverse} ? '>' : '<') }, - [ Identifier($count_alias, $count_col), $first_order ] + { 'SQL.Naive' => ($remapped{inside_order}[0]{reverse} ? '>' : '<') }, + [ + Identifier($count_alias, $count_col), + $remapped{outside_order}[0]{by} + ] ), Alias($count_alias, $first_from) )