Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
nicka
Starting Member
28 Posts |
Posted - 2002-05-22 : 12:00:20
|
| I need help in a query:Initial table(call it tblProduct) is as followsPRODUCT QUOTEDPRICE ORDERAMOUNTA1 10,000 0A1 5,000 1,000A2 6,000 10,000 Query result should be as suchPRODUCT TIMESQUOTED QUOTEDPRICE TIMESORDERED ORDERAMOUNTA1 2 10,000 0 0A2 1 6,000 1 10,000 Essentially I would like to query QuotedPrice and OrderAmount (whenever they are more than 0).Can anyone help. |
|
|
M.E.
Aged Yak Warrior
539 Posts |
Posted - 2002-05-22 : 12:07:42
|
| Little bit low on time, so I don't have enough to write it out fully for you, but lookup info on groupbyselect product, count(orderamount) as 'times ordered'from prodtablegroup by productsorry if thats a little brief, just don't have much time.. group by is you key term.. lookit up |
 |
|
|
dsdeming
479 Posts |
Posted - 2002-05-22 : 14:50:40
|
| In your example you show A1 as having been quoted twice at 10K, but the data indicates it was quoted once at 5K and once at 10K and 1K total units were ordered. This doesn't seem to jive with your desired output. |
 |
|
|
|
|
|