H
Howard
a problem to do with bidding on a limited number of items.
(simplified form)
table1 contains housetype and NumAvailable e.g.
type numAvail
A 7
B 2
C 5
table2 contains bids on buying a type of house with housetype, bidPrice,
customerID e.g.
type bid id
B 500 1
C 700 2
A 400 2
B 800 3
B 900 5
C 700 4
B 300 6
a customer (ID) may make many bids on one or more house types
To see if their bid is bigger than the smallest of the existing bids on
that house type I want to do a query something like SELECT TOP n from
table2 where type = mytype but where the 'n' is taken from table1 i.e.
if there are 2 houses of that type I want the top 2 bids if there are 7
of that type I want the top 7 bids.
I then do a max and min group to see if a new bid is bigger than any of
the 'n' existing bids on that type
How can something like this be done?
Howard
(simplified form)
table1 contains housetype and NumAvailable e.g.
type numAvail
A 7
B 2
C 5
table2 contains bids on buying a type of house with housetype, bidPrice,
customerID e.g.
type bid id
B 500 1
C 700 2
A 400 2
B 800 3
B 900 5
C 700 4
B 300 6
a customer (ID) may make many bids on one or more house types
To see if their bid is bigger than the smallest of the existing bids on
that house type I want to do a query something like SELECT TOP n from
table2 where type = mytype but where the 'n' is taken from table1 i.e.
if there are 2 houses of that type I want the top 2 bids if there are 7
of that type I want the top 7 bids.
I then do a max and min group to see if a new bid is bigger than any of
the 'n' existing bids on that type
How can something like this be done?
Howard