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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-12-06 : 08:42:09
|
| Saikat writes "Respected ALL,My Sql Query is as follows--------select Delivery_Date, delivery, delivery+coalesce((select sum(delivery) from((select d as Delivery_Date,((del*100)/all_postnet) as delivery from (select count(distinct postnet) as all_postnet from all_selected_planet_report) x,(select substring(a.dt_time,1,10)as d,count(distinct a.postnet)as del from maildata a, all_selected_planet_report b, maildlvconfirmation c where a.postnet=b.postnet and a.op_code =c.[operation code] group by substring(a.dt_time,1,10))z)) kwhere k.delivery < p.delivery),0)from ((select d as Delivery_Date,((del*100)/all_postnet) as delivery from (select count(distinct postnet) as all_postnet from all_selected_planet_report) x,(select substring(a.dt_time,1,10)as d,count(distinct a.postnet)as del from maildata a, all_selected_planet_report b, maildlvconfirmation c where a.postnet=b.postnet and a.op_code =c.[operation code] group by substring(a.dt_time,1,10))z)) porder by Delivery descand the output is comming as ------Delivery_Date delivery cummultive sum12/01/2004 10.00 21.0012/02/2004 9.00 11.0011/30/2004 2.00 2.00but i want the output as follows----Delivery_Date delivery cummultive sum12/02/2004 9.00 21.0012/01/2004 10.00 12.0011/30/2004 2.00 2.00I Understand that the problem in sorting. Can u please help in this regard.Thanks well in advanceSK" |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2004-12-06 : 11:06:01
|
| It looks like you are ordering by Delivery desc not by Delivery_Date desc !One of those days...rockmoose |
 |
|
|
|
|
|
|
|