-
SQL retrival
Can anyone help me getting following output to my SQL:
1_ZONE 1_BRANCH JAN-03 500
1_ZONE 1_BRANCH FEB-03 400
1_ZONE 2_BRANCH JAN-03 4400
1_ZONE 2_BRANCH FEB-03 1400
2_ZONE 1_BRANCH JAN-03 1000
2_ZONE 1_BRANCH FEB-03 780
2_ZONE 2_BRANCH JAN-03 2200
2_ZONE 2_BRANCH FEB-03 5000
Where as my following query is giving me branches in any manner irrespective of monthwise...
Thanx in advance
***********************
My query is as follows:
***********************
SELECT
Z.DESCR,
LR.BRANCH_CODE__BKG||' '||
TO_CHAR(LR.LR_DATE,'MON-YY')||' Rs. '||
SUM(LR.SFRT_AMT__2)
FROM
LRBOOKING LR,
BRANCH B,
ZONE Z
WHERE
LR.BRANCH_CODE__BKG=B.CODE
AND
B.ZONE=Z.CODE
AND
LR.LR_DATE BETWEEN '01-JAN-03' AND '28-FEB-03' AND
LR.SFRT_AMT__2>0
GROUP BY
LR.BRANCH_CODE__BKG,Z.DESCR,
LR.LR_DATE
ORDER BY LR.BRANCH_CODE__BKG,LR.LR_DATE
Last edited by ashdiip; 03-24-2003 at 02:02 AM.
-
In your group by clause, replace :
LR.LR_DATE
with
TO_CHAR(LR.LR_DATE,'MON-YY')
You could something similar in your ORDER BY clause.
HTH.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|