473,387 Members | 1,834 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,387 software developers and data experts.

Find a record with a maximum value in a group

Hi everyone,
I have a problem which I think you people can solve.
I am having problems. I have a table which stores surveys submitted. We
have multiple types of surveys, hence a person can have multiple
surveys under his/her name. These surveys have priorities from 0 (min.)
to 3 (max.). My problem is, I want to pick the whole record for a
survey with the maximum priority. For example, I might have 3 survey
records under the name "John Smith" with survey priorities 0,1,2. I
wish to pick the whole survey record which has survey priority 2. And I
wish to do this for each person in the table. I hope I was clear in
explaining the problem. Can anyone help me with this.

Thanks

Nitin

Jun 14 '06 #1
4 3940
Could you post the schemas for your tables so we have a clue where to
start?

Sounds like you need a group by query as a correlated subquery to get
what you want, but without your table structures, it's hard to tell.

Jun 14 '06 #2
Hi,
Some of the fields for my table are:

First Name:
Last Name:
Survey Type (Priority)
Time submitted
Surveyer Last Name:
Surveyer First Name:
Info parameter 1:
Info parameter 2:

Actually in the survey submission process, there are 2 people involved.
One whose survey is to be taken and another one who asks the survey
question to the other person. Here a teacher and a student. The teacher
will be the surveyer and the student will be the person who will be
asked the survey questions. You will ask why multiple surveys? Say the
student was surveyed in two periods of times in a semester. One maybe
after the midterm by a teacher and another after the final exam by
another teacher. And everytime Info parameters were obtained. I wish to
keep the whole record for the most recent survey for that student.

I hope I was clear in explaining in this.

Thanks for the feedback

Nitin

pi********@hotmail.com wrote:
Could you post the schemas for your tables so we have a clue where to
start?

Sounds like you need a group by query as a correlated subquery to get
what you want, but without your table structures, it's hard to tell.


Jun 14 '06 #3
If I were you, I'd read Keri Hardwick's post on creating surveys in
Access. If you build it right, querying is child's play. If you build
it wrong, it's difficult at best and impossible at worst.

Here's the link:
http://groups.google.com/group/comp....b0a9d0315245c2

(careful, the link scrolls to the right...)

Keri's advice has always been spot on, so I'd take it.

Jun 15 '06 #4
Hi,
Thanks for the link. I'll have a look. Actually I am using
ASP/HTML pages to collect data and then submit the data to the Access
database. So it could be a bit tricky to handle it for me using the
Access functionality you have mentioned. I'll surely see if it helps.

Thanks for the feedback...

Nitin

pi********@hotmail.com wrote:
If I were you, I'd read Keri Hardwick's post on creating surveys in
Access. If you build it right, querying is child's play. If you build
it wrong, it's difficult at best and impossible at worst.

Here's the link:
http://groups.google.com/group/comp....b0a9d0315245c2

(careful, the link scrolls to the right...)

Keri's advice has always been spot on, so I'd take it.


Jun 15 '06 #5

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

Similar topics

8
by: Siemel Naran | last post by:
Hi. I have a table of products and versions, and these 2 columns are the unique key. My challenge is to write a SQL statement to find the latest version of each product. My solutions below...
5
by: Andrew | last post by:
Hi All, Have come across something weird and am after some help. Say i run this query where rec_id is a column of table arlhrl, select * from arlhrl where rec_id >= 14260 This returns to...
3
by: Professor Frink | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
1
by: K. Davis | last post by:
I need to increment the maximum value of a field of a table by 1 when a form opens a blank record. (e.g. =max(!![trip_number}) so the logic and references are working at the form level. I've...
4
by: Jason Kumpf | last post by:
OK I've been staring at this code all day and still with everything I have tried I cannot figure out two problems I am having. Once is why the space limit for the directory I create in the code...
0
by: JR | last post by:
Hi, i found a user control on the net see code below it is part of VSEssential but I like the coolProgressBar. Zo I want to use it into my program and I always get the error that it can't find...
1
by: VG | last post by:
Hi folks, I have procedure that I am using to assign ID number vs Autonumber. It is working fine but something going wrong with my form that I have to replace the form with old version to make...
1
by: argniw | last post by:
I need a stored procedure or other method to find the maximum value for each set of records. I would want to eliminate all of the non- maximum records. An example of the data is below. For the...
4
by: SjaakBanaan | last post by:
Hey all, I have a question that ought to be simple but has given me headaches for a while. I have a table with contact email addresses, say. T ID ContID Priority Emailaddress...
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: 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
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
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
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.