469,611 Members | 2,001 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,611 developers. It's quick & easy.

Problem with MONTH() function

I have a query that runs perfectly when doing a date equal comparison
(see last line in the subquery: AND T2.DQ_DAT = '14.02.2005').

A direct comparison of the date is not sufficient for my needs, so I
tried to convert the date using the MONTH() function: (AND
MONTH(T2.DQ_DAT) = 2)

When I try to run this modified query, the query won't run anymore and
hangs up.

Any suggestions?
Please see the query below.
SELECT
T1.DQ_ID,
T1.DQ_DAT,
T1.PROFIT_CENTER_L,
COUNT(BUSINESS_REF) COUNT,
'Not cleaned up' ENTRY_TYPE
FROM SSRP1PP.TIUFDQ02_REP_DATA T1

WHERE DQ_ID = 'IUF0105'
AND T1.DQ_TYP = 'M'
AND T1.DQ_DAT = '31.01.2005'
AND EXISTS (SELECT ''
FROM SSRP1PP.TIUFDQ02_REP_DATA T2
WHERE T1.DQ_ID = T2.DQ_ID
AND T1.DQ_TYP = T2.DQ_TYP
AND T1.TREATY_REF = T2.TREATY_REF
AND T1.OPTION_REF = T2.OPTION_REF
AND T1.BUSINESS_REF = T2.BUSINESS_REF
AND T1.BUSVAR = T2.BUSVAR
AND IFNULL(T1.SEQ,99) = IFNULL(T2.SEQ,99)
AND T2.DQ_DAT = '14.02.2005'
)
GROUP BY
T1.DQ_ID,
T1.DQ_DAT,
T1.PROFIT_CENTER_L
Nov 12 '05 #1
0 1836

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by rdlebreton | last post: by
6 posts views Thread by R. Rajesh Jeba Anbiah | last post: by
8 posts views Thread by ctara_shafa | last post: by
12 posts views Thread by Assimalyst | last post: by
1 post views Thread by Nacho | last post: by
2 posts views Thread by sorobor | last post: by
11 posts views Thread by jessy | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.