The problem is that you are using the '$where' inside the !Links. The $where
as precedence and overides the condition that DBIx::Recordset creates to
link the tables. The solution would be to make the following modifications:

> > >
> > > *set = DBIx::Recordset->Search({
> > >            '!DataSource'           => $dbh,
> > >            '!Table'                => 'A',
> > >            '!Fields'               => 'DATE_FORMAT(LVISIT, ?) AS B_ID,
> > > SUM(UTOTAL) AS VHITS',
> > >            '!NameField'            => ['B_ID','VHITS'],
> > >            '!Links'                => {
> > >                                    '-B'  => {
> > >                                    '!Table' => 'B',
> > >                                    '!Fields' => 'DATE_FORMAT(LVISIT,
?) AS ID, PROFIT',

                                             '!Fields' =>
'DATE_FORMAT(LVISIT, '%b') AS ID, PROFIT',


> > >                                    '!NameField' => ['ID','PROFIT'],
> > >                                    '!LinkedField' => 'ID',
> > >                                    '!MainField'   => 'B_ID',
> > >                                    '$where' => 'LVISIT >= ? AND LVISIT
<=> ? AND LAST_AFFILATE LIKE ?',
> > >                                    '$values' => ['%b','2001-09-02',
'2001-11-16', '%1556-%'],

Instead of the $where and $values use

                                            'LVISIT' => ['2001-09-02',
'2001-11-16'],
                                            '*LVISIT' => ['>=', '<=>'],
                                            'LAST_AFFILATE' => '%1556-%',
                                            '*LAST_AFFILATE' => 'LIKE',

> > >                                    '$order' => 'ID'
> > >                                    }
> > >            },
> > >            '$where'                => 'LVISIT >= ? AND LVISIT <= ? AND
> > > LAST_AFFILATE LIKE ?',
> > >            '$values'               => ['%b','2001-09-02',
'2001-11-16',
> > > '%1556-%'],
> > >            '$group'                => 'B_ID',
> > >            '$order'                => 'B_ID'
> > > });
> > >

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     [EMAIL PROTECTED]         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to