Wednesday, August 8, 2012

Re: Help with getting data

virtual fields are your friend:
http://book.cakephp.org/2.0/en/models/virtual-fields.html 

Am Mittwoch, 8. August 2012 20:22:18 UTC+2 schrieb Daren W:
I am in the learning process and would like to know how to write the two below statements in cake format, could someone please advise.

SELECT SUM(credit) - SUM(debit) AS total FROM `bids` AS `Bid` WHERE `Bid`.`user_id` = 3 LIMIT 1


SELECT SUM(bids) AS total FROM `bidbutlers` AS `Bidbutler` LEFT JOIN `auctions` AS `Auction` ON (`Bidbutler`.`auction_id` = `Auction`.`id`) WHERE `Auction`.`closed` = 0 AND `Bidbutler`.`user_id` = 3

Thanks,
Daren

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

No comments: