Re: mysql date select statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wendell Frohwein wrote:

Hello all, I have this page where I search and add up commissions in a
mysql database. I want to select commissions between a certain date
range.
This is what im currently using but it does not seem to work.
$from="20030101";
$to="20031230";
$search=mysql_query("SELECT SUM(amount) FROM commissions WHERE date
BETWEEN '$from' AND '$to'");

Always use mysql_error() with your queries to see the error. You do not have a GROUP BY clause in your query, so it's failing.


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux