Minimum Date With Group By

Oct 26, 2005

I wondered if anyone new how to return the following

Table of Data

ID|ID2|Date
----------------
1 | 1 | 20/01/05
2 | 1 | 21/01/05
3 | 1 | 19/01/05
4 | 2 | 20/01/05
5 | 2 | 25/01/05

I want to return the minimum date grouped by ID2, but with the corresponding ID i.e.

ID|ID2|Date
----------------
3 | 1 | 19/01/05
4 | 2 | 20/01/05

cheers for your help...

View Replies


ADVERTISEMENT

Return Minimum Value Within Group With ID

Sep 7, 2007

How do I create a query to return just one record, a minimum value for one of the fields, per group within a group that contains an ID field?

This is what my query is returning:
ID, UPC, MinOfAverage Unit Cost
19161, 026851003663, $1.15
15927, 026851003663, $1.11
4459, 026851003663, $1.18
19598, 029695215513, $39.73
15993, 029695215513, $39.29
11694, 029695215513, $48.81

This is what I need:
ID, UPC, MinOfAverage Unit Cost
15927, 026851003663, $1.11
15993, 029695215513, $39.29

I would be *extremely* grateful for an answer. I am new to this list, but I have plenty it MS Access help karma to my name, so I'm hoping to cash some of that that in.

Fingers crossed.

-Tom

View 3 Replies View Related

Forms :: Displaying Minimum Date

Aug 5, 2014

I have six textboxes in my form. First 5 textboxes have dates ( MMDDYYYYY). In the sixth textbox I need to display the minimum date among these five dates.

View 10 Replies View Related

Count Records Between Maximum And Minimum Date

Feb 24, 2008

hi all,
I've got one question regarding dates.
I've already make the form to show the count of records by using query according to the start and end date selected by the user.
What I want is when I open the form, it should show the results of count between the minimum and maximum dates inside the data table. It means I want to show the count result without date specification that is the total count from all records of the whole table .

Can anyone help me how can I make it?
thanks a lot in advance.

View 2 Replies View Related

General :: How To Pull Maximum And Minimum Start And End Date

Jan 11, 2013

I would like to know if it is possible to pull the max and min start date and end date. Basically i have an option where by the user selects the desired date range that they would like.

Now I would like to know how to get the earliest and latest date range should they not select a date range. My date range is being displayed at the top of my report.

View 1 Replies View Related

Max Date On Group

Feb 27, 2008

How do I get just 41 records, each site, plus just the most recent event for that site?

Table 1, Sites (41 Records)
Table 2, Event (42 Records, 1 event for 40 sites, plus 2 events for 1 of the sites)

Totals Query 1, Group on SiteID from Sites, Select Max Date from Event. Good Result. (I get 41 records, 1 for each site, and the site with 2 events shows only the later event)

Query 2: Pull in Query 1, multiple fields from either the Sites Table or the Event Table. Good Result (41 records)

Query 3: Pull in Query 1 and both Tables. Everytime I get 1641 records. I've tried every possible join combination, changing query 1 from Dynaset to Snapshot, etc.

In a help screen I noticed that the sample shows a join with an infinity sign at one end, but I never get that graphic with my joins. Is that an old graphic, or am I missing something?

View 4 Replies View Related

Group By System Date

Dec 5, 2005

hi guys,I want to group a field in my query within a certain period of time, say 1 week. (e.g. between #12/5/2005# and #12/11/2005 23:00:00#) however I need to run this query every week.so I don't want to have to change the dates every week just to run the query.Is there a way to use the system's calendar date so that the values will be input automatically (i.e. to group between today and today-6 23:00:00)?? maybe using date() function or something??:confused: heaps n heaps of thx!!:D

View 2 Replies View Related

Group And Retreive Date By Month

Jul 5, 2005

Hi All.
In a query I grouped DATE by month Date:Format([Date],"yyyy mmm") to calculate visits in each month. My problem is: How to create dialog where user can enter date based only on YEAR and MONTH and enter in this dialog start_date and end_date?
Thanks.

View 1 Replies View Related

Problem With GROUP BY [Date Time]

Aug 30, 2007

Hi there,

I have a table called tblTransactions with columns called (among others) [Date Time], Ticker, Quantity, Price and Commission. Column [Date Time] contains both a date and a time.
I want to determine the commission paid per day. If I use the following code I still get all single trades on a day as the times at which the trades were exucuted are all different. Is it possible to group by full days only without having to change my database in order to determine the daily commission paid?


SELECT T.[Date Time], sum(Commission) AS TotalCommission
tblTransactions AS T
WHERE T.[Date Time]<=#04/17/07#
GROUP BY T.[Date Time];


Best regards,
JapanFreak

View 4 Replies View Related

Queries :: How To Group Rankings By Date

Nov 25, 2014

I have used Allen Browne's suggested method of ranking to rank by the date each client settled... Now I need to group the rankings by the referring company as below... so it ranks each client referred by referral company from earliest to latest - like so:

ReferrerID___ClientID___TotalValue___BeatenBy (Ranking)
Intro1_______CatCo_____6/11/14________4
Intro1_______DogCo_____8/3/14_________1
Intro1_______FishCo_____17/5/14________3
Intro2_______AntCo_____11/1/14________2
Intro1_______PigCo______2/4/14_________2
Intro2_______BirdCo_____12/8/14________3
Intro2_______FrogCo_____6/1/14________1

My current SQL view of my query looks like this:

SELECT qryDates.ClientID,
qryDates.TotalValue,
(SELECT Count([ClientID])
AS HowMany
FROM qryDates AS Dupe

[Code] ....

View 5 Replies View Related

Queries :: MAX Date Of Records - Add Another Field But Don't Want It To Group On It

Oct 28, 2014

I have a query that feeds another query. The first query needs to carry the Primary key, a secondary key (grouped by) a date (Maxed on) and an operator key (to group on) ...

At the moment I cant include the primary key because it groups on it and therefore every transaction is reports, my sql is -- How can I include the primary key MatterContactsMadeId and still get the max date for an operator within a matter

Code:

SELECT MatterContactsMade.MatterId, Max(MatterContactsMade.DueDate) AS MaxDueDate, MatterContactsMade.Operator
FROM MatterContactsMade
GROUP BY MatterContactsMade.MatterId, MatterContactsMade.Operator
HAVING (((Max(MatterContactsMade.DueDate))<=[Forms]![MattersBUpLogOptionsFrm]![txtBUpDate]) AND ((MatterContactsMade.Operator)=[Forms]![MattersBUpLogOptionsFrm]![txtOperator]))
ORDER BY MatterContactsMade.MatterId;

View 1 Replies View Related

Modules & VBA :: Option Group - IIF Date Return

May 2, 2014

I have a date field in a form fed by an option group. Most of the options return the correct values, but I'm having a hard time with this:

If the inspection date (in another form) is in Jan Feb or March, then return the date 1 Apr of the inspection year. If not, then return 1 Apr of the following year.

Here is the trouble line:

Code:
Case 2
IIf (Month([Forms]![FrmGeneralInspection]![txtInspectionDate]) <= 3), Me![txtReInspectionDate] = DateSerial(Year([Forms]![FrmGeneralInspection]![txtInspectionDate]) + 1, 4, 1), Me![txtReInspectionDate] = DateSerial(Year([Forms]![FrmGeneralInspection]![txtInspectionDate]) + 2, 4, 1)

View 4 Replies View Related

Populate Option Group When Date Field Is Entered

May 24, 2005

I have a form where users fill in a date resolved and click complete in the Option Group, it's default value is incomplete. I have a problem with the users forgetting to change it to complete when the enter the date resolved. Is there a way to change the option group value when the date resolved is entered?

View 6 Replies View Related

Populate Option Group When Date Field Is Entered

May 24, 2005

I have a form where users fill in a date resolved and click complete in the Option Group, it's default value is incomplete. I have a problem with the users forgetting to change it to complete when the enter the date resolved. Is there a way to change the option group value when the date resolved is entered?

--- OR ---

Can it notify the user that they need to change the Option Group?

View 3 Replies View Related

Queries :: Group Results By Criteria Date Range

Sep 23, 2014

Below is a simplified example of what I'm trying to achieve with a parameter query.

The source table for the query contains two fields:

Reading_Date (short date) and Use_value (integer)

The parameter query sums Use_value between two dates for various date ranges specified as 'or' criteria. SQL as follows:

SELECT Sum(Table1.Use_Value) AS SumOfUse_Value
FROM Table1
WHERE (((Table1.Reading_Date) Between #1/1/2013# And #1/5/2013#)) OR (((Table1.Reading_Date) Between #1/1/2014# And #1/5/2014#));

This produces a single sum total, but I'd like the query to give a total per criteria date range. In other words to group results by criteria. As date ranges may span year change, grouping by year is not possible.

View 4 Replies View Related

Forms :: Subform Filtered By Date / Group-by Category?

Mar 9, 2014

Table: Transactions: ID,Date,Title,Category,Value, Budget Name
Table: Budget: Budget Name
Budget Years: Budget Name, Date From, Date To

Form entitles Budget, Fields : Date From, Date To, Budget Name

So within the form budget I have a subform which I want to group the categories and get a total value. THE tricky part is, I only want it to include values from the budget specified in the form and the date range of the form.

View 1 Replies View Related

Queries :: Group Overnight Shift Time Together For One Date

Oct 24, 2014

I am collecting data every hour on the hour and I would like to group this data according to Shift (A, B and C) by Date. The only problem I am having is- how can I keep the overnight shift together as one date? 10pm - 6am

I was able to do a simple query where I was able to assign an A, B, or C depending on the field with the Short Time format using nested IIF statements. From there I was able to group by shift (A, B, or C) per date. However the C Shift is split up.

Example. Can Sunday October 5th 10pm to Monday October 6th 6am be grouped as one date.

View 2 Replies View Related

Run Query That Will Group All Records By Company And By Date And Provide Sum Of QTY

Jan 17, 2013

I have a table (table1)that table has several columns: company / Qty / date / ERT...I want to be able to run a query that will group all the records by Company and by date and provide the sum of QTY - as well as the cumulative totals for each company and date.

My query looks like this:
amonth: MONTH CODE
Group By
assending

Field 1: Alias: Company
Group by

Ascending

Field 2: QTY
Table1
Sum

Field 3: Runtot: DSum("qty","table1","[month code]=" & [amonth] & " And [company]=" & [alias] & "")..I have the query set up - but my runtotal Dsum formula is giving me grief - specifically a #ERROR and I can't figure it out..I basically want it to look like this:

A company 15/Nov/2012 10 10
A Company 16/Nov/2012 10 20
B Company 12/Jan/2012 15 15
B Company 21/Mar/2012 5 20

View 3 Replies View Related

Getting The Minimum Value?

Jan 28, 2005

Hello,

I have a table which has repeated IDs, I want to find the start of the ID then mark it as Y in the next field, the remaining repeated IDs should have blanks in the next field, how do I do this, thanks for any help

View 3 Replies View Related

Minimum Quantity

Aug 9, 2007

hi

i try to build an access form .

i have "big" table that fill in the name of the product , the quantity , and a minimum quantity.

the field : min quantity give us the quantity that is the minimum of the product.

i have a "minimum" table that has the list of the product and the minimum quantity.



i want to see the minimum quantity of a product , when i type the product (in the form if it possiable , if not - in a report)



eran

View 2 Replies View Related

Minimum Values

Jul 8, 2005

I have a counter on my form which will increase or decrease depending on weather a number of tick boxes report true or false. Is it possible to set a minimum aloud value on a box regardless of other criteria. At present I can depending on certail criteria, finish up with a - number which for other reasons, I dont want.

View 14 Replies View Related

Minimum Record Set Must Be One

Mar 6, 2006

Hi All,

I have a main form and 5 tabs within that mainform that are subforms. They are linked by an EventID.

The subforms are continuous forms, but only one record is "required". What kind of code do I need to make sure that the data entry person enters at least one record in each subform.

Also, is there a way that when I am tabbing through my subform and get to the second record and leave it blank, that when I press tab it will take me to the first record of the next tab subform.

I appreciate your responses.

View 2 Replies View Related

Queries :: Count Number Of Tasks - Group By Date / Time In A Query

Aug 14, 2013

I want to count the number of tasks by department by week. I need the time so my date the task was added is formated as a date/time.

I created a query and added the department (twice so that I can group and count), and transaction date. I clicked on totals and added the count function under the department. I added this criteria to the task date: between [start date] and [end date].

Problem is that it's grouping by day and each one is different because all times are different. How do I group these by day and not time?

View 7 Replies View Related

Minimum Value For A Report Field

Dec 18, 2006

I have a field in a report that is calculated to generate a dollar amount. Well the people who need this have some strange rules about how they get their dollar amounts. Mostly they just round up to the nearest dollar, which is no problem. But they also want a minimum charge of $2.00. So my problem is if the calculation works out to be 0.01 to 1.00, it will say 1.00 and it is going to be wrong because they will want it to be 2.00. So is there a way to set a minimum value for this field, or where should I go to try this?

View 4 Replies View Related

Minimum Values In A Query

Aug 18, 2005

Hi

I have a table (tbl1) with three fields/columns (Primary key, NameID, Number). E.g.:

NameID ... Number
Mike ........ 2
Mike ........ 3
Mike ........ 19
Ronald ...... 1
Ronald ...... 2
Greg ........ 7
...

I would like to make a query that lists each NameID only ONCE, with corresponding MINIMUN Number. So the result from the upper example would be:

NameID ... Number
Mike ......... 2
Ronald ....... 1
Greg ........ 7


How do I do it???


Thank you in advance

m.

View 8 Replies View Related

Minimum From Multiple Tables

May 17, 2013

I have a query that is working, but I am looking to make it faster. We import 13 csv files daily into 13 Access tables. The files have an ItemID and price. We need to get the minimum of the raw data across the 13 tables & then manipulate the prices some (in the query) and get the lowest of the manipulated prices again for the 13 tables for each ItemID - some might be blank. We are using a MinOfList function in the query to get the minimum of the 13 numbers. But this is very time consuming since we have to run the Min function twice (with 13 input parameters) for each ItemID - about 15,000 records. It takes about 1 minute to run the query.

View 2 Replies View Related







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