Queries :: To Find First / Second / Third And Fourth Highest Number

Sep 7, 2014

I need finding the First to fourth highest numbers in four columns.

For Example:

Student Name Subject1 Subject2 Subject3 Subject4
Max 60 40 50 10

I need query to find the first, second, third and fourth highest marks in subjects.

View Replies


ADVERTISEMENT

Queries :: Find Result In A Table Containing Highest Date Value - Too Many Results

Jul 6, 2013

Setup a query to find the result in a table containing the highest date value.

The query is linked to two tables : Payment information containing the date, and tenant information containing the tenant.

In the query i have selected the tenant name from the payment table (which is linked to the tenant name in the payment table) and the payment terms - ie weekly / monthly etc. I've then selected the payment date from the payments table.

The query should return for each tenant the latest date they paid.

On the pay date i selected the Max option.

But it shows me more than one record.

SQL query is shown here

SELECT Max(tblPayments.DateDue) AS MaxOfDateDue, tblLease.cboPaymentTerms, IIf([cboPaymentTerms]=2,DateAdd("ww",1,[DateDue]),IIf([cboPaymentTerms]=3,DateAdd("ww",2,[DateDue]),IIf([cboPaymentTerms]=4,DateAdd("ww",4,[DateDue]),IIf([cboPaymentTerms]=1,DateAdd("m",1,[DateDue]),"n/a")))) AS calcNextPayDueDate, tblPayments.cboTenant
FROM tblPayments INNER JOIN tblLease ON tblPayments.cboTenant = tblLease.cboTenant
GROUP BY tblLease.cboPaymentTerms, IIf([cboPaymentTerms]=2,DateAdd("ww",1,[DateDue]),IIf([cboPaymentTerms]=3,DateAdd("ww",2,[DateDue]),IIf([cboPaymentTerms]=4,DateAdd("ww",4,[DateDue]),IIf([cboPaymentTerms]=1,DateAdd("m",1,[DateDue]),"n/a")))), tblPayments.cboTenant;

View 2 Replies View Related

Queries :: Looping Through Query To Find Highest Priority Item

Aug 20, 2013

I have a database where part of it consists of an Item table and a Formula table. There is a many-to-many relationship between them so I created a junction table for this purpose.

Tables
tblItem
tblFormula
tblFormula_Item_JNT

There is a column in tblFormula called [Priority] that is a lookup field. It has the values of "High", "Medium", "Low".

So here's what I'm trying to do: I have a query that searches against tblItem for all Items that have a value of No/False for a field called Item_Status. That's simple enough. But I also want to show the Priority of the Formula that the Item belongs to. When I add that to my initial query I get multiple results of the same Item if it belongs to more than one Formula, which I understand. But I really want an Item to show up only once.

I want the query to go through each Item (based on its Item_ID), look through all the Formulas it's in, and if at least one of those Formulas has a Priority of "High" then it will display "High" in a field (could be a calculated field) in the query results. If there are no "High" Priority Formulas, then look for if there are any "Medium" Priority Formulas, etc.

View 2 Replies View Related

Second Highest Number

Aug 10, 2007

I'm trying to identify the 2nd highest number in a field in Access. While searching, I ran across the =large(a1:a3,2) formula, which works perfectly in Excel. I'm trying to duplicate this functionality in Access 2003, but it looks like this formula isn't in there. Any ideas on how to accomplish this?

View 5 Replies View Related

Select Highest Number And Update

May 19, 2007

This database is for a livestock show that I have been working on for quite some time now. This specific 'section' is for the Supreme Competitor award, in which points are given for the showman's placing in showmanship, ONE highest placing animal in market classes, ONE highest placing animal in breeding classes, and the showman's score on a quiz. I'm having a problem assigning 'points' for a single highest placing animal in market and breeding classes.

I would like to create a query/s that selects all animals shown by an exhibitor in a market class, then take the highest placing animal that the exhibitor had and award (update the livestock table-points field) points for a single animal. This is fine until one exhibitor has MORE than one animal that received 1st place. How do I go about telling the query to just pick one, lol... it doesn't matter which 1st place animal it selects to award the points... just as long as only ONE animal is updated and not all of the exhibitor's animals that received 1st... Then do this again to select one highest placing animal from the breeding classes.

Here's a little outline just for visual sake:

Market Classes

Name Tag No Class Placing <points field update>
Sally Johnson 100 1 1st 10
Sally Johnson 101 2 1st
Sally Johnson 102 3 1st
Kim Smith 200 1 2nd 5
Kim Smith 201 4 2nd
Kim Smith 202 5 3rd

See where Sally received 3 1st places, but only one of them is selected to be updated, and Kim received 2 2nd places (her highest placing) and only one is updated.

Thanks SO much in advance... this has really got me stumped.

View 1 Replies View Related

Queries :: Wildcards - Find Any Number Of Numeric Values

Oct 3, 2013

How do you search for any number of numeric characters using wildcards? The # symbol only searches for 1, and * obviously includes letters.

Example:
I have:
D1234
D3
D5336767
D123F

My search should only retrieve the first 3 values.

WHERE FieldName LIKE 'D[0-99999999]' does not seem to work.

View 5 Replies View Related

Queries :: How To Find MS Access Version Number In Java Code

Aug 5, 2013

Is there a way to find version number of MS Access using java code.

View 3 Replies View Related

Queries :: Need A Way To Retrieve First Highest Value

Oct 3, 2013

using access 2010. I have a table where I need to pull out the highest value. But sometimes; there are two or more with the same high value. I need a way to retreive the first highest value. I've done this before a while ago and I can't make it work again. I started off with grouping highest value but are getting all three same values.

View 2 Replies View Related

Queries :: Highest Value Of A Count Field

Jan 23, 2014

I have 4 columns

PostCode
District
District Name
Count of Postcodes = Count(Left([hull_PostCode.PostCode],4))

Now some Postcodes display 4 lines as they cover 4 Districts, my questions is I only want to show the highest Count per postcode and disregard the rest, Ive tried many variations of the Max function but am a little stuck.

View 1 Replies View Related

Find The Lowest Number And Place The Number And Column Name Into In Field

Dec 15, 2005

I have a access table with 32 columns and 42,000 rows of numbers. I need to find the MIN number in the row and if the MIN number has duplicates then I need them all placed into another column by column name.
Example:
Starting file
DEST,ORIGIN1,ORIGIN2,ORIGIN3,ORIGIN4, ETC
05512,3,2,4,2

ENDING table needed
DEST,ORIGIN1,ORIGIN2,ORIGIN3,ORIGIN4, NEWCOLUMNname
05512,3,2,4,2,2 ORIGIN2 ORIGIN4

Where the new column name contains the MIN number in the row and all of the associated duplicates column names.

View 1 Replies View Related

Dlookup To Find The A Number =&gt;

Feb 9, 2007

Hello,

I have had a search through the forums but cannot find anything that is relevant to my issue. Hope someone can help.

I have a table with scores and then grades

tbl_scoregrade

Score,Grade
-999,10
133,9
239,8
342,7
449,6
570,5
709,4
785,3
862,2
917,1

I want to reference a field called "score_result" and generate a grade from my grade table and place it in a field called "grade".

In excel I use the following formula, but it does not work in access.

=IF(ISBLANK(C51),0,VLOOKUP(C51,Scorecard!H7:I13,2, 1))

Is there a way of doing this in Access?

View 1 Replies View Related

Find / Display Next Available Number?

Nov 20, 2014

I am creating a form for users to enter data. Each entry needs to have a "Event ID" associated with it and these Event IDs may be used more than once but will refer to the same Event (if it was a single entry with no duplicates, I would just use the rows primary key). How to create a query that looks at a list of existing numbers (Events already in the table) and returns the next/an unused number? I would like to create a button that says "Next available Event ID" and provides the user with a number.

View 4 Replies View Related

Find Consecutive Number Of Records In DB!

Aug 14, 2006

Hello,
I am trying to generate some query result on a form.
My DB consists of the following fields : tradeID and profit/loss.
How do i make a query to find the Maximum consecutive number of wins and losses in the database and display the results on a form?


Would really appreciate it if any of you have tried to sort and display results for finding consecutive number of events in any database!


Thanks a lot

View 2 Replies View Related

General :: Using Wildcards To Find Number In A Sentence

Mar 4, 2013

I should find the position of a number in a sentence and later extracted. The number is attached always to an "E". ie: E1, E2, E3,E4. The range of the number is 1-4. I have this until now:

X: InStr("E[#]",[Col1_Comment_1])

but it always return 0

View 5 Replies View Related

Modules & VBA :: How To Find If Field Contains Number In The String

Oct 7, 2014

I am looking to find if a field contains a number and then build a case statement depending on which number is found. The field will contain data just like this:

Quote:

Repaired frequency response and grounding issues. Replaced 2 Hybrids, capacitors, and connectors. Tested MER/BER and operation to specs.

Here is my code that did not work:

Code:
If Me.txt_work_comm1 Like "*Hybrid" Then
'Sets up auto priced based on number of hybrids entered
'1 hybrid
If Me.txt_work_comm1 Like "*1" Then
strCriteria = "repair_item = 'Charter RF Amplifier Repair + 1 Hybrid' AND profile_types = 'Alpha'"

[Code]....

To Summarize:
1. I need to find if the word "Hybrid" or "Hybrids" is in the field
2. Then I need to know how many to determine a price

View 1 Replies View Related

Queries :: Find A Way For Access To Find Unique Dates And Unique Names?

Aug 1, 2014

I have been working on a simple data base for some time now (beginner level) and am still trying to improve it. I would like to do something but before that I would like to have your opinion to know if it is even possible?I have a query QryMainReport:

Start Date/Time
End Date/Time
Employee

At the moment this is what the format of my report looks like (I removed other unnecessary fields):

StartTime----------EndTime---------------Employee
12/06/2014 01:00--12/06/2014 03:00------John Smith
12/06/2014 04:00--12/06/2014 06:00------Jane Doe
13/06/2014 02:00--13/06/2014 05:00------John Smith
13/06/2014 08:00--13/06/2014 08:00------Jane Doe

I would like to do as a report. (Dates would always be from Sunday to Saturday). I am not sure it is possible to do that. I suppose first it would mean:I would have to do a query to separate the times from the dates?I would have to find a way for Access to find the unique dates and unique names?Does it mean I have to use cross tab queries?

View 2 Replies View Related

Modules & VBA :: Updating Or Adding Records To Form - Find MAX Of Number Portion

Jun 28, 2013

I want whenever I'm updating or adding records to my form, the ID automatically take the value of the previous ID and increment it by 1.

The field type is text (mixed with number) - PM0000000.

I've done some research, what I understand is that I need to:

-do a lookup and
-find the MAX of the number portion.

Name of form - Payment
Name of table - Payment
Name of field - payment_id

I tried these, but to no avail...

Private Sub payment_id_Click()
payment_id = DLookup(("[payment_id]", "Payment", "[payment_id]=Forms![Payment]![payment_id]-1")payment_id + 1)
End Sub

[Code] .....

View 8 Replies View Related

Highest Value

Jan 16, 2006

(I am a notive in database calculations) I have a human resources database with a report that calculates how long a person has been employed and calculates vacation and sick time based on the number of years employed. Is there a way to take the single highest value in vacation time text box and multiply it by a predetermined number? (i.e., if 5 is the highest number in the list for the person, multiply it by 24)

Thanks in advance.

View 2 Replies View Related

Highest Value

Oct 1, 2004

question,

how do i select the highest value of a column in a MS ACCESS database with a sql statement???

thnx

View 2 Replies View Related

Highest Value In Query

Oct 27, 2005

I have 3 fields in query. I want the highest value from field2 in field3. Shown as below: How I do this without using Group By?

field1 field2 field3
1 1 2
1 2 2
2 1 3
2 2 3
2 3 3

View 3 Replies View Related

Select Second Highest Value

Sep 13, 2006

Hello,

I am looking for a query to select the second highest value (in this case a date) from a table.

For example, if I had the following dates:
9/1/06
9/2/06
9/3/06
9/4/06

I would want the results of my query to be 9/3/06.

My table is called tblEquityFunds and the field I'm looking to select is called Added. I have the following query, which I think works, but it seems like an awfully goofy way to do it:

SELECT DISTINCT TOP 2 Max(tblEquityFunds.Added) AS MaxOfAdded
FROM tblEquityFunds
WHERE tblEquityFunds.Added Not In (Select Max(Added) FROM tblEquityFunds))

Is there a more elegant solution?

View 5 Replies View Related

Dmax - To Return Not Quite The Highest

Jan 18, 2006

Hello,

I am using DMax() to return the highest date in a table, but really need it to return the second-highest...so, if I had:

14th Feb
10th Dec
1st Jan

I don't want it to return 10th Dec, I want it to return 14th Feb

Any help much appreciated. I am sure there was something like dmax()-1, but that just returns (in my example above) 9th Dec!

Thanks!

View 4 Replies View Related

Highest Character Count In A Field

Dec 17, 2007

I have a large table (over 20,000 records) where the text fields were all set at 255 - even those requiring a single character entry. Is there a way to determine the highest existing character count for each field so I can set the text fields to a reasonable setting? After a compact and repair will existing records be set to the new setting?

View 1 Replies View Related

Finding The Highest Of A Count Query

Oct 25, 2005

Hi,

I am using this sql query : -

SELECT Monthly_below_report.Device
FROM Monthly_below_report
GROUP BY Monthly_below_report.Device, Monthly_below_report.[FS-ID]
HAVING (((Monthly_below_report.[FS-ID])=780));


The problem is this currently pulls out 5 records (all devices found and the amount of times they appear).

How can i get it to pull out JUST the highest count.

I.E :-
that query above will pull out
15
12
10
3
1

How can i get it just to display 15.

Thanks
k0r54

View 6 Replies View Related

Selecting The Two Highest Values Among Three Fields

Sep 13, 2006

I'm teaching this term, and have put my grades and roster in Access. Each grading opportunity is a separate field.

Students will have to take 3 exams (Exam1, Exam2, and Exam3); however, their grade is based only on the 2 highest exam grades. There are other grades...FinalPaper, Attendance, Paper1, Paper2... the total of the grades is 600 points.

I can do the other calculations... what I do not know how to do is to select the two highest test values from the 3 Exam fields. I coudl do it manually, but I really prefer to simply enter grades, and then have the final grade calculated.

Thanks.

Gayle Ann

View 3 Replies View Related

Defining The 3 Highest Values In A Series Of Fields

Nov 2, 2007

Hello Everyone,

I am in need of your vast array of knowledge and experience. I have been fighting with this Access report for a few days now, and I've finally decided to ask for your help.

I am running a report which provides a look at a set of 12 survey results. The 12 items are numerical in nature and are decimals with 2 decimal places. What I am trying to do is have Access automatically highlight the top 3 scores in one color, and the bottom 3 scores in another color.

So what I need is an expression that allows Access to discern the top 3 and bottom 3 from the series of 12 scores. in Excel you can identify the top score with this with the formula "Max(A1:A13)", but seeing as in Access we don't have the cell identifiers, this approach will not work.

I know that I will need to use conditional formatting in order to get the cells to highlight. I also see that there is "Max" and "Min" functions in Access as well, and I attempted to create and expression like this "=Max([field 1] AND [field 2] AND [field 3] AND, etc...)" with no luck. I also tried changing the "AND" to "OR", again without luck.

One thing that I should mention is that the report does contain a lot of other data, so I need to be able to apply whatever the best fix is, to only those 12 fields.

Unfortunately I am not accustomed to using code, and as a result I am unsure of how to input it properly. I am certainly open to code solutions, but I would also need a explanation of how to put it in properly.

The easiest solution for me, if possible, would be an expression that I can enter into the conditional formatting wizard to tell it to highlight the values.

If anyone has any ideas, I would appreciate it. I'll buy you a virtual beer :-)

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved