473,386 Members | 1,644 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.

Displaying columns not in Group By or SELECT

Hi All,

Basically how can I get around the GROUP BY rule of having column names in both SELECT and GROUP BY clauses?
I have a query that needs to display two key fields, a field that shows a MAX amount for each category, and also the 2 other supporting fields. My problems is getting the 3 supporting fields to show since GROUP BY only lets me display the aggregate field and the fields used to group. I think some type of JOIN might help but I can't get my head around it. Below is an example of my table.

Expand|Select|Wrap|Line Numbers
  1. Table:
  2. NAME     SESSION    SCORE      MINUTES          COLOR
  3. -----------    -------------     -----------       --------------          ------------
  4. Tom             1                30            10                       Red
  5. Bob              1               23              3                      Blue
  6. Bob              1               12             5                        Red
  7. Tom             2                 1             2                        Yellow 
  8. Bob             2                8              1                        Red
  9. Bob            2                16              3                         Red
  10.  
With Name & Session (together) being the key fields, SCORE being what I do MAX() on, and the other two as supporting data and I would like this output

Expand|Select|Wrap|Line Numbers
  1. NAME     SESSION    SCORE      TIME           COLOR
  2. -----------    -------------     -----------       -------          ------------
  3. TOM            1               30            10                  Red
  4. Tom             2              1                2               Yellow 
  5. Bob             1              23               3                  Blue
  6. Bob             2              16               3                   Red
  7.  
Thanks!
Dec 6 '07 #1
0 1522

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

Similar topics

8
by: euang | last post by:
Hi, I have been using access 2000 for two years on WINDOWS NT to display dynamic aweb page using ASP My ISP has now changed to Windows 2003, and I am having major problems displaying...
5
by: JackT | last post by:
Hi, I have the following SQL SELECT Table1.Col1, Table3.Col1 AS Expr1, COUNT(Table1.Col2) AS Col2_No, COUNT(Table1.Col3) AS Col3_No etc, FROM Table3 INNER JOIN Table2 ON...
5
by: Ross Presser | last post by:
The purpose, as you can probably guess, is to produce a set of sample documents from a large document run. The data row has a CLUB column and an IFC column; I want a set of samples that contains...
3
by: Shawn | last post by:
Hi guys, I'm trying to compose a query that will select all columns from a table, but without any duplicates. E.g. table name is 'tblShipment' columns are: fldUnique(pk) | fldShipNo |...
6
by: Matt K. | last post by:
Hi there, I have a form in an Access project that contains a subform which displays the results of a query of the style "select * from where = #a certain date#". In the main part of the form...
7
by: Susan Bricker | last post by:
Sorry..I keep hitting the wrong key and sending the post too soon... The problem: COMBOBOX not displaying all possible rows. The RecordSource (generated by SQL view of the Query Builder) is:...
2
by: .Net Sports | last post by:
I have a data grid that takes data from a data table, and in visualstudio.net, I cannot find the error in the debugger at why I am not able to see my datagrid when querying data for a specific date...
3
by: Sardaukary | last post by:
Hello, >From the following table showing which countries people have been to Name Countries Fred France Fred UK Bill Germany Jack USA
2
by: =?Utf-8?B?RGFuaWVs?= | last post by:
Hi Guys i wanted to find out, what is the sql statement i need to count the number of rows in search query and also the statement i need for displaying columns that are not null I'm writing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.