I have a view in MySql which I call with
*return  $this->query("select * from proposed_batch where due_date
>='".$from."' and due_date <='".$to."'"); *
in one of my models.
I am getting two arrays per row [r] and [*

proposed_batch

*], I want to get only one  [*

proposed_batch

*].
What is the problem?
*The MySql view:*
CREATE VIEW `kids`.`proposed_batch` AS
select
    `r`.`user_id` AS `user_id`,
    `s`.`name` AS `service_name`,
    `r`.`title` AS `title`,
    `r`.`name` AS `reciept_name`,
    `p`.`id` AS `id`,
    `p`.`circulation` AS `circulation`,
    `p`.`bank` AS `bank`,
    `p`.`branch` AS `branch`,
    `p`.`account` AS `account`,
    `p`.`cheqe` AS `cheqe`,
    `p`.`amount` AS `amount`,
    `p`.`name` AS `name`,
    `p`.`created` AS `created`,
    `p`.`service_id` AS `service_id`,
    `p`.`vat` AS `vat`,
    `p`.`sign` AS `sign`,
    `p`.`reciept_id` AS `reciept_id`,
    `p`.`due_date` AS `due_date`,
    `p`.`credit_company` AS `credit_company`,
    `p`.`credit_method` AS `credit_method`,
    `p`.`invoice_id` AS `invoice_id`,
    `p`.`batch` AS `batch`,
    `p`.`noinvoice` AS `noinvoice`
from
    ((`kids`.`reciepts` `r`
    join `kids`.`payments` `p`)
    join `kids`.`services` `s`)
where
    ((`p`.`reciept_id` = `r`.`id`)
and (`p`.`service_id` = `s`.`id`)
and isnull(`r`.`canceled`)
and isnull(`p`.`invoice_id`)
and (`p`.`noinvoice` = 0))
order by `p`.`reciept_id`,`p`.`due_date`

*The result:*
*

Array
(
    [0] => Array
        (
            [r] => Array
                (
                    [user_id] => 4e475639-fb00-402b-b55c-7fc5e7cdc48c
                    [title] => dddd
                    [reciept_name] => דוד רינה מרני
                )

            [proposed_batch] => Array
                (
                    [service_name] => שנת לימוד
                    [id] => 46
                    [circulation] => cheqe
                    [bank] => 1
                    [branch] => 23
                    [account] => 234
                    [cheqe] => 345
                    [amount] => 2500.00
                    [name] =>
                    [created] => 2011-08-24 23:35:54
                    [service_id] => 1
                    [vat] =>
                    [sign] =>
                    [reciept_id] => 254
                    [due_date] => 2011-09-10
                    [credit_company] =>
                    [credit_method] =>
                    [invoice_id] =>
                    [batch] =>
                    [noinvoice] => 0
                )

        )

    [1] => Array
        (
            [r] => Array
                (
                    [user_id] => 4e475639-fb00-402b-b55c-7fc5e7cdc48c
                    [title] => dddd
                    [reciept_name] => דוד רינה מרני
                )

            [proposed_batch] => Array
                (
                    [service_name] => שנת לימוד
                    [id] => 47
                    [circulation] => cheqe
                    [bank] => 1
                    [branch] => 23
                    [account] => 234
                    [cheqe] => 346
                    [amount] => 2500.00
                    [name] =>
                    [created] => 2011-08-24 23:35:57
                    [service_id] => 1
                    [vat] =>
                    [sign] =>
                    [reciept_id] => 254
                    [due_date] => 2011-10-10
                    [credit_company] =>
                    [credit_method] =>
                    [invoice_id] =>
                    [batch] =>
                    [noinvoice] => 0
                )

        )

    [2] => Array
        (
            [r] => Array
                (
                    [user_id] => 4e475639-fb00-402b-b55c-7fc5e7cdc48c
                    [title] => dddd
                    [reciept_name] => דוד רינה מרני
                )

            [proposed_batch] => Array
                (
                    [service_name] => שנת לימוד
                    [id] => 48
                    [circulation] => cheqe
                    [bank] => 1
                    [branch] => 23
                    [account] => 234
                    [cheqe] => 347
                    [amount] => 2500.00
                    [name] =>
                    [created] => 2011-08-24 23:35:59
                    [service_id] => 1
                    [vat] =>
                    [sign] =>
                    [reciept_id] => 254
                    [due_date] => 2011-11-10
                    [credit_company] =>
                    [credit_method] =>
                    [invoice_id] =>
                    [batch] =>
                    [noinvoice] => 0
                )

        )

)

*

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to