472,351 Members | 1,482 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,351 software developers and data experts.

Help me with group by query in MYSQL 3.x

Hello experts,

I have a little group by problem, hope you can help me.
I have a lot off records which I want to group by "HOUR(timefield)"


01-02-2005 13:28:00 25.0
01-02-2005 13:11:01 24.0
01-02-2004 13:10:03 23.5
01-01-2005 12:08:00 25.0
01-01-2005 12:01:01 24.0
01-01-2004 12:00:03 23.5

I want to group them by HOUR(timefield) if I do this I get the first
record of all the groups
result below:
01-02-2004 13:10:03 23.5
01-01-2004 12:00:03 23.5

However I want the last records of each group
result I want:
01-02-2005 13:28:00 25.0
01-01-2005 12:08:00 25.0

Who can help me on this
thanks guys

Dec 11 '05 #1
3 1735
"Wire" <wi*****@zonnet.nl> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I have a little group by problem, hope you can help me.
I have a lot off records which I want to group by "HOUR(timefield)"
However I want the last records of each group

See the thread "problem with nested select" a couple of days ago on this
newsgroup. Your problem is equivalent to the one in that thread.

Bill K.
Dec 12 '05 #2
Hi Bill

I saw the thread
but I think that is not my problem
Please help

Dec 12 '05 #3
Wire wrote:
I have a little group by problem, hope you can help me.
I have a lot off records which I want to group by "HOUR(timefield)"

You need to join the table with itself to gain the results you wish.
Examples can be found from the comments in this page (subquery examples
won't work with 3.x, so don't bother trying those).

Dec 12 '05 #4

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

Similar topics

by: Petre Agenbag | last post by:
Hi List Can anyone help me to do the following without the need of subselects: I have a table that contains rows where mostly, the only...
by: Jim | last post by:
I need help on a query. There is a common titles database for several radio stations Some titles are enabled and some are not enabled for each...
by: Ljoha | last post by:
I need to create report where will be shown total quantity of all rows for every hour in some data range. I have a table where I have column in...
by: phillip.s.powell | last post by:
MySQL 3.23.58 - 4.0.17 (yep, several database server instances, don't ask) I have database Spring with table Students I have database Summer...
by: Dejan | last post by:
hy I have two mysql servers. One is on my local comp (localhost) and the other is something.com Creating simple php script to do this... ...
by: Chuck36963 | last post by:
Hi all, I've been working on a listing problem and I can't figure out how to work it out. I have looked far and wide on the web to find answers,...
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM...
by: axlq | last post by:
I'm trying to figure out a MySQL query expression to match an email address. Here's the situation: User registers on my site with a "plus style"...
by: inexion | last post by:
Hello, I'll try to explain what I'm trying to accomplish here, hopefully not too bad a task. Basically I have an existing table with data that...
by: chienee | last post by:
here is the code <?php session_cache_limiter('private,must-revalidate'); session_start(); require_once("config.php"); include...
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

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.