SELECT SUM(Field14) AS Amount, 1 AS [Band ID]
FROM orders
WHERE (((Field14) Between 0.00 And 9999.99))
UNION SELECT SUM(Field14) AS Amount, 2 AS [Band ID]
FROM orders
WHERE (((Field14) Between 10000 And 39999.99))
UNION SELECT SUM(Field14) AS Amount, 3 AS [Band ID]
FROM orders
WHERE (((Field14) Between 40000 And 99999.99))
;
The above SQL query works 'OK' however the bands are hard coded.
My boss!! would like me to create a new table which has three colums
Band ID LowerBand UpperBand
So as the user can change and add bandings at 'The drop of a hat'
The other table has the amounts in field 14 however there is no reference to a group banding.
So I'm after creating a temp table in which the amounts are allocated to a band and the I can sum the different bands.
Simple, Easy, I hear you say.
So why have I just spend 4 Hours going around in circles.
[PC3]
Any ideas? / Or any better ideas
Please Help
Thanks
Craig
FROM orders
WHERE (((Field14) Between 0.00 And 9999.99))
UNION SELECT SUM(Field14) AS Amount, 2 AS [Band ID]
FROM orders
WHERE (((Field14) Between 10000 And 39999.99))
UNION SELECT SUM(Field14) AS Amount, 3 AS [Band ID]
FROM orders
WHERE (((Field14) Between 40000 And 99999.99))
;
The above SQL query works 'OK' however the bands are hard coded.
My boss!! would like me to create a new table which has three colums
Band ID LowerBand UpperBand
So as the user can change and add bandings at 'The drop of a hat'
The other table has the amounts in field 14 however there is no reference to a group banding.
So I'm after creating a temp table in which the amounts are allocated to a band and the I can sum the different bands.
Simple, Easy, I hear you say.
So why have I just spend 4 Hours going around in circles.
[PC3]
Any ideas? / Or any better ideas
Please Help
Thanks
Craig