Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent-Matrix repot query

Status
Not open for further replies.

urchin556

IS-IT--Management
Mar 14, 2004
22
US
HI guys i am making a matrix report in which the 'DATE BOOKED IN" will be my columns.the problem is that its not getting order by properly. for e.g it should show
JAN-01,FEB -01 ,MAR-01 instead of this it is showing data in the following manner
JAN-01,JAN-02,JAN-03,FEB-01. Please suggest me any workaround.I had even tried by adding an extra date column for order by but it didnt work.

select a.SEGMENT1 "Stock Code",
a.DESCRIPTION "Description",
to_char(b.date_received,'Mon yy') "Date Booked In",
sum(b.transaction_quantity),
nvl(c.item_cost,0) "Item cost"
from mtl_system_items_b a,
MTL_ONHAND_QUANTITIES b,
cst_item_costs c
where a.inventory_item_id=b.inventory_item_id
and a.inventory_item_id=c.inventory_item_id and
a.organization_id=b.organization_id and
a.organization_id=c.organization_id
AND b.date_received<=sysdate-90
and 'S'=:d
group by a.SEGMENT1 ,
a.DESCRIPTION,
to_char(b.date_received,'Mon yy'), nvl(c.item_cost,0)
order by "Date Booked In
 
Add another column date_sort to the SQL:
Code:
select a.SEGMENT1          "Stock Code",
   a.DESCRIPTION    "Description",
   to_char(b.date_received,'Mon yy') "Date Booked In",
[b]   to_char(b.date_received,'yymm') "date_sort",[/b]
    sum(b.transaction_quantity),
 nvl(c.item_cost,0) "Item cost"
from  ...
then drag date_sort to the column group to sit in front of the "Date Booked" field, then set break order "Ascedding" for the date_sort.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top