From: Peter Rabbitson Date: Sat, 3 Nov 2012 16:32:13 +0000 (+0100) Subject: Clarify CookBook example (RT#78283) X-Git-Tag: v0.08204~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=363e4e04aa57c5c99a4b4cf747181f070b74d185;p=dbsrgits%2FDBIx-Class.git Clarify CookBook example (RT#78283) --- diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index bec5a96..c684ed7 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -354,8 +354,8 @@ from, select, and +select attributes. my $rs = $cdrs->search({ year => { '=' => $cdrs->search( - { artist_id => { '=' => { -ident => 'me.artist_id' } } }, - { alias => 'inner' } + { artist_id => { -ident => 'me.artist_id' } }, + { alias => 'sub_query' } )->get_column('year')->max_rs->as_query, }, }); @@ -364,11 +364,11 @@ That creates the following SQL: SELECT me.cdid, me.artist, me.title, me.year, me.genreid, me.single_track FROM cd me - WHERE year = ( - SELECT MAX(inner.year) - FROM cd inner - WHERE artist_id = me.artist_id - ) + WHERE year = ( + SELECT MAX(sub_query.year) + FROM cd sub_query + WHERE artist_id = me.artist_id + ) =head2 Predefined searches