D
Deleted member 120674
Guest
I'm a hobbyist with only basic understanding of SQL and Ms Access, so please bear with me while I try to explain my question. I'm trying to do something that obviously is way
out of my league... I did a lot of searching and trying, but I guess I just don't really know what I'm looking for or understand what I'm supposed to do
. Thanks for your help!
I'm trying to define a query that will ultimately show me the number of bottles of wine in a pricerange. So the end result should look something like:
PriceRange NumberOfOccurrences
>100------12
0-10-------50
10-25----149
25-50------29
50-100-----17
I have a table [Wijn] (Wine) with the prices in it in a field called [Marktwaarde] (market value). So the Pricerange should be divided into the segments above. I used a Count to construct the overview above using this Query:
(See Count_rslt.png)
Problem is, it counts the number of times a PriceRange occurs (i.e. a wine has one PriceRange), but what I would like it to do is sum the amount of bottles in stock in the overview.
The number of bottles present is located in the same table [Wijn] in three separate fields (depending on where they are stored): [WK], [WR] and [WB]. I just can't seem to be able to define an overview (table) with the ranges and the bottles in that range. I also tried DSUM without really understanding it's possibilities, but the way I used it, it will only give me the sum of a particular range:
(see dsum_rslt.png)
Can somebody please relieve me from my ignorance? Thanks!


I'm trying to define a query that will ultimately show me the number of bottles of wine in a pricerange. So the end result should look something like:
PriceRange NumberOfOccurrences
>100------12
0-10-------50
10-25----149
25-50------29
50-100-----17
I have a table [Wijn] (Wine) with the prices in it in a field called [Marktwaarde] (market value). So the Pricerange should be divided into the segments above. I used a Count to construct the overview above using this Query:
Code:
SELECT TablePriceRange.PriceRange, Count(*) AS NumberOfOccurrences
FROM (SELECT IIf(Marktwaarde>=0 And Marktwaarde<10,"0-10",IIf(Marktwaarde>=10 And Marktwaarde<25,"10-25",IIf(Marktwaarde>=25 And Marktwaarde<50,"25-50",IIf(Marktwaarde>=50 And Marktwaarde<100,"50-100",">100")))) AS PriceRange FROM Wijn) AS TablePriceRange
GROUP BY TablePriceRange.PriceRange;
Problem is, it counts the number of times a PriceRange occurs (i.e. a wine has one PriceRange), but what I would like it to do is sum the amount of bottles in stock in the overview.
The number of bottles present is located in the same table [Wijn] in three separate fields (depending on where they are stored): [WK], [WR] and [WB]. I just can't seem to be able to define an overview (table) with the ranges and the bottles in that range. I also tried DSUM without really understanding it's possibilities, but the way I used it, it will only give me the sum of a particular range:
Code:
SELECT DSum("[wb]+[wk]+[wr]","Wijn","[Marktwaarde]<10") AS Expr1
FROM Wijn
WHERE (((Wijn.Marktwaarde)<10));
Can somebody please relieve me from my ignorance? Thanks!