| Author |
Topic |
|
rajdey1
Starting Member
10 Posts |
Posted - 2009-04-25 : 13:48:45
|
| hi pls help me to write sql querry for the followingthe details of the product that has been sold the mostTable order_details(order_no,order_date,product_no,customer_id,quantity)Table Product(product_no,Product_name,Price,cures,product_type) |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2009-04-25 : 16:06:26
|
| select p.*from Product pjoin(select top 1 product_no, s=sum(quantity)from order_detilsgroup by product_noorder by s) son p.product_no = s.product_no==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
rajdey1
Starting Member
10 Posts |
Posted - 2009-04-25 : 23:57:39
|
| hi the sql statement you have given doesnt work |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-26 : 03:32:54
|
Please explain your definition of "doesn't work". E 12°55'05.63"N 56°04'39.26" |
 |
|
|
rajdey1
Starting Member
10 Posts |
Posted - 2009-04-26 : 07:53:26
|
| on runing the querry gives a message syntax error in from clause |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-26 : 08:03:16
|
Try exchange order by swithorder by sum(quantity) desc E 12°55'05.63"N 56°04'39.26" |
 |
|
|
rajdey1
Starting Member
10 Posts |
Posted - 2009-04-26 : 08:26:38
|
| tried but still doesnot work actually problem with from clause before join keyword |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
|
|
rajdey1
Starting Member
10 Posts |
Posted - 2009-04-26 : 16:11:49
|
| not spamming i working hard to solve the problem jus begging help from the members of the forum |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-04-27 : 09:45:14
|
| since you're "working hard to solve the problem" please provide what you have tried so far for each of your posts. That will help us gauge what your level is as well as prove to us that you are in fact putting in some effort.Be One with the OptimizerTG |
 |
|
|
|