Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query not working with between condition

Author  Topic 

shajimanjeri
Posting Yak Master

179 Posts

Posted - 2012-05-14 : 05:49:49
I have query like this

Select NVL(SUM(TRANS_QTY),0) FROM IC_TRAN_PND where ITEM_ID IN (130,131) and line_type=1 AND COMPLETED_IND=1 AND
to_date(TRANS_DATE,'DD-MON-YY') Between to_date('01-JAN-12','DD-MON-YY') and to_date(('04-JAN-12'),'DD-MON-YY')

this query not returning the total sum of records between the two date ranges.

Do I need to convert something. Your support pls.

Regards

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-05-14 : 07:03:10
quote:
Originally posted by shajimanjeri

I have query like this

Select NVL(SUM(TRANS_QTY),0) FROM IC_TRAN_PND where ITEM_ID IN (130,131) and line_type=1 AND COMPLETED_IND=1 AND
to_date(TRANS_DATE,'DD-MON-YY') Between to_date('01-JAN-12','DD-MON-YY') and to_date(('04-JAN-12'),'DD-MON-YY')

this query not returning the total sum of records between the two date ranges.

Do I need to convert something. Your support pls.

Regards

Are you using Microsoft SQL Server? If not, this would not be the right forum. You would get better and faster responses at other places such as dbforums.com

Edit: Besides, duplicate of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=174684
Go to Top of Page
   

- Advertisement -