Ordering number query

J

JME

hi all,

i have table book which is shown below:
BookID Price Cost
1 $20 $18
2 $15 $12
3 $17 $15
4 $46 $41
5 $54 $50
6 $57 $50
7 $112 $111
8 $20 $18
9 $77 $74
10 $96 $91
11 $44 $41
i created Query1 which SQL view is:
SELECT [Book].[BookID], [Book].[Price], [Book].[Cost]
FROM Book
GROUP BY [Book].[BookID], [Book].[Price], [Book].[Cost]
ORDER BY [Book].[Price] DESC;

But now i want to modify query1 such that i will be;
Persent BookID Price Cost NewBookID NewPrice
30% 9 $77 $74 9 $77
40% 6 $57 $50 6 $57
50% 5 $54 $50 6 $57
60% 4 $46 $41 4 $46

Condition:
Persent: x% from total bookID on query1(in this case from
30%-60% by range of 10%)
NewBookID: if the cost turn out to be the same, choose
highest BookID in that particular cost.Otherwise use same
BookID.
NewPrice:follows its value from NewBookID

Please help me to clarify this

rgds,
JME
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top