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

Last Function in Query

I have a subquery where I am sorting first by ProductNumber and then by DateStamp.

I want to find the last quantity of each product on a given date (the quantity changes throughout the day). My query currently groups by ProductNumber, looks for Max DateStamp, and Last Quantity. But it is not working properly. The Quantity never seems to be the actual last quantity, but something in the middle somewhere, even though I can see that the subquery is sorting properly, and it is correctly finding Max of DateStamp.

Is there some way to pull the Quantity from the same record as the Max DateStamp is read from?

Thanks!
Dec 6 '10 #1
2 1992
Nevermind, I found the problem. It turns out that if I use WHERE instead of GROUP BY and HAVING in the subquery, the results in the query are screwed up.
Dec 6 '10 #2
Lysander
344 Expert 100+
Hi Coolboy,

Edited cause I dont have a delete option
Dec 6 '10 #3

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

Similar topics

1
by: J.R | last post by:
I'd like to reload a parent page from a child page but not have the parent execute it's last executed function, yet have it maintain it's control state? Any ideas, Thanks. John.
1
by: muelli75 | last post by:
Hi! Im getting insane by solving a problem .... I try to define a function which uses a code-snippet from another file. My base are the codes from the great book "WebDataBase-Book by H....
5
by: Jim | last post by:
Need help with aggregate function...for each unique product, I need the provider with the cheapest cost factor Here't the table (Table1) ID product provider factor 1 123456 abc...
8
by: Jean | last post by:
Hello all, I have the following data, that was queried and sorted to columns PROBLEM_ID and then by STATUSDATE (ascending): STATUS_ID STATUSDATE PROBLEM_ID --------- ---------- ...
3
by: Nick Keighley | last post by:
Hi, I want a particular function to run after everything has beeen destructed. It's looking for memory leaks. atexit() doesn't seem to suit my purpose as global statics can be destructed...
2
by: icyajax | last post by:
HI All, I m trying to write an SQL query in VBA to a sql string. It will be used for a search form. I want the query to evaluate multiple text boxes filled in by the user. For example, they are...
1
by: lanlife | last post by:
Hello everyone Please, I want to know how i can get the last mysql query issued into the mysql server with php.
2
by: scott | last post by:
Hi Everyone, I have a table which has many fields in it but I need to pull some specific info via a query and I don't know if it's possible. I want to run a query which includes two tables....
3
by: Halimat | last post by:
I have a table in MS Access and ran a query to return some distinct record, it works fine but a similar table in Oracle 9i using similar query (sql) failed. Find below the MS Access Orignal table,...
11
by: trackside | last post by:
I'm using the great dd.dragdrop Library for many parts of the page, including loading in a user selected image via the "swapImage()" function. var imgRe = /^.+\.(jpg|jpeg|gif|png)$/i; ...
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: 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...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.