473,465 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Mysql query

Hi,

I have a database with a date field. And I would like to see the report
grouped by a ceratin month and year, how can I do that without multiple
queries?

Albert Ahtenberg
Jul 16 '05 #1
5 11887
What format is the date field stored in?

Is there a day, month, and year field (separate)?
Is it a timestamp?
Is it something else?

-Jim Stapleton

"Albert Ahtenberg" <do**********@this.address> wrote in message
news:bd**********@tabloid.uwaterloo.ca...
Hi,

I have a database with a date field. And I would like to see the report
grouped by a ceratin month and year, how can I do that without multiple
queries?

Albert Ahtenberg

Jul 16 '05 #2
It is the MySql DATE type. looks like (DD-MM-YYYY).

"Steven James Samuel Stapleton" <st**********@mps.ohio-state.edu> wrote in
message news:mcgHx12drhfu@ohstpy...
What format is the date field stored in?

Is there a day, month, and year field (separate)?
Is it a timestamp?
Is it something else?

-Jim Stapleton

"Albert Ahtenberg" <do**********@this.address> wrote in message
news:bd**********@tabloid.uwaterloo.ca...
Hi,

I have a database with a date field. And I would like to see the report
grouped by a ceratin month and year, how can I do that without multiple
queries?

Albert Ahtenberg


Jul 16 '05 #3

First get a real email address if you want real replies.

On Fri, 27 Jun 2003 20:54:25 -0400, Albert <do**********@this.address> wrote:
It is the MySql DATE type. looks like (DD-MM-YYYY). ^^^^^^^^^^
This isn't a MySQL date format.
select * from mydatabase where datefield like "2003-07%";

This works for me.


"Steven James Samuel Stapleton" <st**********@mps.ohio-state.edu> wrote in
message news:mcgHx12drhfu@ohstpy...
What format is the date field stored in?

Is there a day, month, and year field (separate)?
Is it a timestamp?
Is it something else?

-Jim Stapleton

"Albert Ahtenberg" <do**********@this.address> wrote in message
news:bd**********@tabloid.uwaterloo.ca...
> Hi,
>
> I have a database with a date field. And I would like to see the report
> grouped by a ceratin month and year, how can I do that without multiple
> queries?
>
> Albert Ahtenberg
>
>



--
Michael Vore, W3CCV M-ASA [Ka8]; WHIRL, ABC; CAW, CW, AAW
http://mike.vorefamily.net/ohmywoodness <-Custom Woodworking
http://mike.vorefamily.net/thewoodenradio <-The weblog
Jul 16 '05 #4
Mike,

Regarding my Email address, I got so much spam when I posted my Email
address on this forum so I decided not to. Besides, I can't see the
relevancy of my Email to this at all.

Now, what you suggest will choose all the records with the date July/03.
What I need is not to have them selected by the date but grouped by a
certain date. I will give you an example. Suppose I have a 'date' field and
a 'sum' field. What I need is a report about the total sum in each month.
And I wonder what is the most simple way to do it.

Regards,
Albert Ahtenberg

"Mike Vore" <mv***@ix.netcom.cam> wrote in message
news:sl******************@snowmass.mystic.ct...

First get a real email address if you want real replies.

On Fri, 27 Jun 2003 20:54:25 -0400, Albert <do**********@this.address>

wrote:
It is the MySql DATE type. looks like (DD-MM-YYYY).

^^^^^^^^^^
This isn't a MySQL date format.
select * from mydatabase where datefield like "2003-07%";

This works for me.


"Steven James Samuel Stapleton" <st**********@mps.ohio-state.edu> wrote in message news:mcgHx12drhfu@ohstpy...
What format is the date field stored in?

Is there a day, month, and year field (separate)?
Is it a timestamp?
Is it something else?

-Jim Stapleton

"Albert Ahtenberg" <do**********@this.address> wrote in message
news:bd**********@tabloid.uwaterloo.ca...
> Hi,
>
> I have a database with a date field. And I would like to see the report > grouped by a ceratin month and year, how can I do that without multiple > queries?
>
> Albert Ahtenberg
>
>


--
Michael Vore, W3CCV M-ASA [Ka8]; WHIRL, ABC; CAW, CW, AAW
http://mike.vorefamily.net/ohmywoodness <-Custom Woodworking
http://mike.vorefamily.net/thewoodenradio <-The weblog

Jul 16 '05 #5
Albert Ahtenberg wrote:
select * from mydatabase where datefield like "2003-07%";


maybe
select year(datefield), month(datefield), sum(valuefield)
from table
group by year(datefield), month(datefield)

HTH

--
"Yes, I'm positive."
"Are you sure?"
"Help, somebody has stolen one of my electrons!"
Two atoms are talking:
Jul 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Lenz Grimmer | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, MySQL 4.0.14, a new version of the popular Open Source/Free Software Database, has been released. It is now available in source and binary...
0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
1
by: Cern | last post by:
Is it somebody out there who has made a migration from an Oracle server to an MySQL server?? The scenario is as simply: I've got a Oracle 8 server with a database with content that I want to...
1
by: jlee | last post by:
I'm pretty much a newbie on mysql, and I need some help. I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4 (i386) on a server hosting an active website. The site's developer...
1
by: Good Man | last post by:
Hi there I've noticed some very weird things happening with my current MySQL setup on my XP Laptop, a development machine. For a while, I have been trying to get the MySQL cache to work....
3
by: Juan Antonio Villa | last post by:
Hello, I'm having a problem replicating a simple database using the binary log replication, here is the problem: When the master sends an update to the slave, an example update reads as follows:...
1
by: Ike | last post by:
Recently, I began using a different MySQL verver (i.e. different machine as well as different version#, going from 4.12a to 4.1.9 max). The following query used to work: select firstname,...
3
by: Me Alone | last post by:
Hello: I am trying to edit some C code I found in "The definitive guide to using, programming, and administering MySQL" by Paul DuBois. This C client program connects and then segfaults when...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.