[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

[sqr-users] Order by the values obtained in the amount columns



I am having a small problem in figurin this out maybe someone has done this 
before 
   
  Here is my problem ..... here is the sql i have written
   
  select cust_name , item_amt , billable_flg 
  from ps_xxx
  where ....
  order by billable_flg desc , cust_name
   
  The output will order by billable_flg and customer name .... here is the 
result of the output 
   
  billable_flg   name   item_amt
       Y            A.....   123.22
       Y            B....    0.00
       Y            C....    21.00
       N            A....    213.22
       N            B....    321.22
   
  what i am finally supposed to do is ....to put all the item_amt which are 
equal to zero at the end but just before the billable_flg is changed to 'N' 
from 'Y'
   
  final output required
   
  billable_flg   name   item_amt
       Y            A.....   123.22
       Y            C....    21.00
       Y            B....    0.00
       N            A....    213.22
       N            B....    321.22
   
  any ideas on how to do it ...even if u know some order by syntaxes that i can 
try let me know i can test it on my query
   
  Thanks,
  Ashwin

                
---------------------------------
 New Yahoo! Mail is the ultimate force in competitive emailing. Find out more 
at the Yahoo! Mail Championships. Plus: play games and win prizes.

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users