niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » IBM DB2
Problem with MONTH() function
Post new topic   Reply to topic Page 1 of 1 [1 Post] View previous topic :: View next topic
Author Message
Sebastian
*nix forums addict


Joined: 22 Feb 2005
Posts: 69

PostPosted: Tue Feb 15, 2005 12:43 pm    Post subject: Problem with MONTH() function Reply with quote

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
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [1 Post] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 3:23 am | All times are GMT
navigation Forum index » Databases » IBM DB2
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Unknown in header problem -SOLVED- Light Speed Postfix 0 Thu Jul 03, 2008 10:40 am
No new posts problem with sending mail nuxia Postfix 0 Mon Apr 21, 2008 3:58 am
No new posts Postfix 2.3.8 Virtual problem Blotto Postfix 0 Fri Apr 04, 2008 6:11 am
No new posts Postfix sending problem for local domain remote email monkey_magix Postfix 0 Mon Sep 10, 2007 10:17 am
No new posts bounce problem murkis Postfix 0 Sun Oct 08, 2006 3:45 pm

Bankruptcy | Sprint Ringtones | Bankruptcy | Remortgages | 3dge Viral Emails
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2159s ][ Queries: 16 (0.1566s) ][ GZIP on - Debug on ]