B
Bruce
Hi,
Can somebody help me work out the Most Common Price based on the Value at
that price. Lets say I have a table called tbl_COS and it has the fields,
ImportDate, Price and Value.
1. The query should first sum the value on each day at a certain price level.
2. Next it should select the Price where Value is the Maximum for each day.
I have worked out step 1 as follows but am stuck on 2.
SELECT tbl_COS.ImportDate, tbl_COS.Price, Sum(tbl_COS.Value) AS SumOfValue
FROM tbl_COS
GROUP BY tbl_COS.ImportDate, tbl_COS.Price;
Here is some sample data. The correct result would be 0.91
ImportDate Price SumOfValue
20080327 0.775 88,720
20080327 0.780 972,482
20080327 0.785 972,782
20080327 0.790 391,586
20080327 0.795 388,124
20080327 0.800 19,730
20080327 0.900 275,782
20080327 0.905 296,296
20080327 0.910 1,064,228
20080327 0.915 554,944
20080327 0.920 331,747
20080327 0.925 128,751
Any help appreciated,
Bruce
Can somebody help me work out the Most Common Price based on the Value at
that price. Lets say I have a table called tbl_COS and it has the fields,
ImportDate, Price and Value.
1. The query should first sum the value on each day at a certain price level.
2. Next it should select the Price where Value is the Maximum for each day.
I have worked out step 1 as follows but am stuck on 2.
SELECT tbl_COS.ImportDate, tbl_COS.Price, Sum(tbl_COS.Value) AS SumOfValue
FROM tbl_COS
GROUP BY tbl_COS.ImportDate, tbl_COS.Price;
Here is some sample data. The correct result would be 0.91
ImportDate Price SumOfValue
20080327 0.775 88,720
20080327 0.780 972,482
20080327 0.785 972,782
20080327 0.790 391,586
20080327 0.795 388,124
20080327 0.800 19,730
20080327 0.900 275,782
20080327 0.905 296,296
20080327 0.910 1,064,228
20080327 0.915 554,944
20080327 0.920 331,747
20080327 0.925 128,751
Any help appreciated,
Bruce