|
|
|
I have a table with a DATETIME field and i want to know how many records of each day i have.
simply grouping by the field gives me nothing cause i get 1 of each diffrent date/hour.
What you need to do is use the DATE_FORMAT function like :
SELECT DATE_FORMAT(MyDate, '%d %M %Y') AS Date, COUNT(*) AS num FROM MyTable
GROUP BY Date ORDER BY MyDate DESC;
This will give us:
18 November 1999 10
17 November 1999 20
16 November 1999 25
15 November 1999 12
14 November 1999 300
13 November 1999 23
12 November 1999 14
11 November 1999 678
10 November 1999 256
.
.
.
.
|
|
| Point and Click Interface ala MS Access for creating SQL statements. Categories : MySQL, Complete Programs, General SQL, PHP, Databases | | | Safe Authorization SELECT query Categories : MySQL, Databases, General SQL | | | This function will populate the options in a drop down HTML select list
in a form from a database query.
Categories : MySQL, General SQL, PHP, HTML and PHP, Databases | | | I`d like to use the mysql_fetch_row function along with a "randomizer"
function that would give me a random result from a mySQL table. Categories : General SQL, MySQL, PHP, Databases | | | phpEasySQL - Easily connect to your MySQL database with just 1 php file and 3 easy steps! Categories : Databases, PHP, MySQL, General SQL | | | This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server. Categories : Databases, MySQL, Complete Programs, PHP, Databases | | | You have a set of many resources , and You need to know wich of these resources are available for a given use during a given period but MySql does not allow SUB-Selection :(
here is the right way to do that in a single query
Categories : MySQL, General SQL, Databases, Algorithms | | | bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager Categories : MySQL, PHP, MySQL, Complete Programs, Databases | | | Multiple Search using PHP and Mysql Categories : PHP, Databases, General SQL, MySQL | | | Displaying records of database in more than one page (paging) Categories : Databases, MySQL, PHP | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | Cut your MySQL Connections to 1 line of code Categories : PHP, Beginner Guides, Databases, MySQL | | | phpAds, a complete banner and ad management system with detailled tracking and stats. Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases | | | Automatically printing the contents of an sql table in MySQL. Categories : MySQL, PHP, HTML and PHP, Databases | | | Email a user with out exposing email address Categories : PHP, Databases, MySQL, Email | |
|
|
|