Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 12th, 2005, 04:42 AM
cvrle cvrle is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: Belgrade, Serbia
Posts: 15 cvrle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 13 m 38 sec
Reputation Power: 0
Lightbulb Dmax problem

I have table with this fields:
Article_ID, Date_In, Q_In, Date_Out, Q_Out

I need query (report) that will show only
the last Date_In and the last Date_Out
for each Article_ID.

I think the solution is in the filter with
Dmax function.I find out how to use
this function in form (using VBA) but I just
don't get it how this works in query.

The records looks like this:
Article_ID,Date_In, Q_In,Date_Out,Q_Out

cu001 01/05/05 55 0 0
cu002 02/05/05 30 0 0
cu001 0 0 05/05/05 20
cu002 0 0 08/05/05 10

Any help will do.Thanks

Reply With Quote
  #2  
Old September 16th, 2005, 01:40 AM
cvrle cvrle is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: Belgrade, Serbia
Posts: 15 cvrle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 13 m 38 sec
Reputation Power: 0
I find out the solution that will give me the last Date_IN for every Article_ID. So my suggestion is to split this problem in two queries (one for Date_IN and one for Date_out) and then insert it new table . Maybe there is a better solution but this one worked for me (the amount of quantities is not important for me and the query gives the sum )

SELECT DISTINCTROW TableName.Article_ID, Max(TableName.Date_IN) AS MaxOfDate_IN, Sum(TableName.Q_IN) AS [Sum Of Q_IN]
FROM Tablename
GROUP BY TableName.Article_ID;

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Dmax problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT