![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Database Database problems or need to ask a question? maybe something to do with sql injections or a database software question. Database topics cover MySQL, PostgreSQL, Oracle, SQL Server or anything else related to databases. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Hi I have a problem - I use mysql db to store some stats data and I'm trying to retrieve information on how many visitors came to my site in each day of particular month i have the following columns +-----------------------+---------------+------+-----+---------+------------ ----+ | Field | Type | Null | Key | Default | Extra | +-----------------------+---------------+------+-----+---------+------------ ----+ | id | int(10) | | PRI | NULL | auto_increment | | timeofentrance | timestamp(14) | YES | | NULL | | +-----------------------+---------------+------+-----+---------+------------ ----+ if i run: select count(*) as sum from stats WHERE EXTRACT(MONTH from timeofentrance)='03' ; the result is ok - I get the sum of all entrances in march but then I want to group it by days so I use: select count(*) as sum from stats WHERE EXTRACT(MONTH from timeofentrance)='03' GROUP BY EXTRACT(DAY from timeofentrance); and... it does nothing - i get the same result - not divided into days if i run the same query without the WHERE clause, I get the results I want but not limited to the month I'm retrieving data for... any suggestions? i use mysql 3.23.54 -- TIA Patol | |||
|
| Advertisements |
| | #2 | ||
| "Patrol" <patryk.bezspamuprosze@alfatel.zadnegospamu.pl> wrote in message news:d04ofd$eh4$1@opal.icpnet.pl... > Hi > I have a problem - I use mysql db to store some stats data and I'm trying to > retrieve information on how many visitors came to my site in each day of > particular month > > i have the following columns > +-----------------------+---------------+------+-----+---------+------------ > ----+ > | Field | Type | Null | Key | > Default | Extra | > +-----------------------+---------------+------+-----+---------+------------ > ----+ > | id | int(10) | | PRI > | NULL | auto_increment | > | timeofentrance | timestamp(14) | YES | | NULL | > | > +-----------------------+---------------+------+-----+---------+------------ > ----+ > > if i run: > > select count(*) as sum > from stats > WHERE EXTRACT(MONTH from timeofentrance)='03' ; > > the result is ok - I get the sum of all entrances in march > but then I want to group it by days so I use: > > select count(*) as sum > from stats > WHERE EXTRACT(MONTH from timeofentrance)='03' > GROUP BY EXTRACT(DAY from timeofentrance); > > and... it does nothing - i get the same result - not divided into days > if i run the same query without the WHERE clause, I get the results I want > but not limited to the month I'm retrieving data for... > > any suggestions? > i use mysql 3.23.54 > > -- > TIA > Patol Just put EXTRACT(DAY from timeofentrance) in to the select part! | |||
|
| | #3 | ||
| > Just put EXTRACT(DAY from timeofentrance) in to the select part! well, I gave it a try but it didn't help... any other ideas? I guess I'll just have to loop the query 31 times... anyway, thanks Patrol | |||
|
| Featured Websites | ||||
|
![]() |
| Tags: group, together, working |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| TV Cards--- DVB-t Duo Not working | Three Wise Men | Operating Systems And Software | 0 | 05-28-2007 11:53 PM |
| Is there an Adwords group? | RobbieB | Google questions | 0 | 05-28-2007 12:46 AM |
| Right group? | Rolf Barbakken | MSN questions | 0 | 05-28-2007 12:18 AM |
| RSS Bot Jim is working (( so fare )) | MadKad | Community Chat | 5 | 04-05-2006 10:56 AM |
| Featured Websites | ||||
|