473,386 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

GROUP BY troubles

Hi, I'm trying to write a Group By query.
I have a table that looks like this:

Expand|Select|Wrap|Line Numbers
  1. label        value        version
  2. Fee          25.99        5795
  3. Term         3            5795
  4. Terminated   0            5562
  5. Terminated   1            5563
  6. Terminated   0            5794
  7. Terminated   0            5795
  8.  
I want to GROUP BY label using a MAX aggregate function on the version column to obtain the following table

Expand|Select|Wrap|Line Numbers
  1. label        value        version
  2. Fee          25.99        5795
  3. Term         3            5795
  4. Terminated   0            5795
  5.  
I tried the query but it says I need to contain all columns in either the GROUP BY clause or an aggregate function.
Dec 28 '11 #1
5 1609
Rabbit
12,516 Expert Mod 8TB
Your intention is not a group by at all. Your goal is merely to select the record with the Max revision for each label as opposed to grouping by label. What you should do is take the Max revision for each label and use that to filter for the record you want.
Dec 28 '11 #2
Can you give me an example using the tables in the first post.
Dec 28 '11 #3
Rabbit
12,516 Expert Mod 8TB
What you're looking for is similar to this thread http://bytes.com/topic/access/answer...ng-latest-date.
Dec 28 '11 #4
Hi, I tried the example but it still didn't work. Can you write a specific example for this question?
Dec 28 '11 #5
Rabbit
12,516 Expert Mod 8TB
Show me what you mean by you tried the example.
Dec 29 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: lmckaha | last post by:
Hi, Mysql version: 3.23.49 Solaris version: 2.7 gcc compiler version: 2.95.2 Python : 2.2.2 I'm evaluating the C and C++ API to decide which one to bye but I have many troubles.
5
by: LabRat | last post by:
I've been working lately to build a dynamic library (in this case, a win32 dll) and I have encountered huge problems with it. This is my first real attempt at doing anything like this, so it's...
3
by: Mike Dundee | last post by:
I am importing data into a new database (the database still has to be set up) and have a problem. The comma delimited text files I am importing have four fields containing date and date/times. ...
0
by: Michal | last post by:
I have troubles with instaling .Net Framework 2.0 (Beta 2 - 2.0.50215). The main instalation went just fine, troubles begin with my attemt to run aspnet_regiss.exe -i. Asp.Net is instaled into IIS...
4
by: bugbear | last post by:
Hello; I have (tried) to change my geocities site to be "styled" not "tabled". It's certainly made the HTML nicer. But it doesn't work as nicely I'd like. And it almost doesn't work at...
19
by: bugbear | last post by:
I've been using this technique for around a year to create "decorated" tabs and round cornered boxes (windows?) http://www.alistapart.com/articles/slidingdoors/ Everything worked fine (all...
22
by: Ted | last post by:
This page http://homepage.ntlworld.com/r.a.mccartney/test/utf-8_test_file_hacked_for_ie_with_local_dtd.xml doesn't work properly in Firefox or IE6. The faults are different. In Firefox the...
3
by: The Frog | last post by:
Hi everyone (anyone....) I am just wanting to see if anyone else is experiencing issues with posting and searching this group. I am having some problems and noticing some odd behaviour, but...
4
by: bhughes2187 | last post by:
I am using access 2003, I am querying the table scarlet using a statement sql1 = "select rpt from scarlet where rpt <> '~' group by rpt" basically, rpt will have values of ~, A, B, C, D. A can...
1
by: Pegasus | last post by:
Good morning, I'm Filippo Battaglia. We're porting Apache STDCXX under Nanodesktop. We are trying to make nd compatible also with C++ and not only with C. Unfortunately, we're finding different...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.