Home » SQL & PL/SQL » SQL & PL/SQL » please CHECK THE QUERY?
please CHECK THE QUERY? [message #311295] Fri, 04 April 2008 00:25 Go to next message
tondapi
Messages: 99
Registered: August 2007
Location: usa
Member
Hi,

please CHECK THE BELOW QUERY,IT DISPLAYING WORNG DATA.
WHEN I AM GIVING 2007 IT DISPLAYING 2007 DATE .BUT I WANT TO DISPLAY 2007-2008 DATE.MEANS APR-2007 TO MAR-2008.

SELECT DISTINCT TO_CHAR(SUMMARY_DATE,'Mon-YY')
FROM CALENDAR_DATE
WHERE
SUMMARY_DATE BETWEEN '01-Apr-'||TO_CHAR(SUMMARY_DATE,'YYYY')
AND
'31-Mar-'||(TO_CHAR(SUMMARY_DATE,'YYYY')+1)
AND TO_CHAR(SUMMARY_DATE,'YYYY') = '2007'


WHAT CAN I DO FOR CORRECT DATA
Re: please CHECK THE QUERY? [message #311298 is a reply to message #311295] Fri, 04 April 2008 00:34 Go to previous messageGo to next message
Michel Cadot
Messages: 64131
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You still don't want to follow the rules, you:
- post in upper case
- don't format
you will not have my help.

Regards
Michel
Re: please CHECK THE QUERY? [message #311325 is a reply to message #311298] Fri, 04 April 2008 01:51 Go to previous messageGo to next message
MarcS
Messages: 312
Registered: March 2007
Location: Antwerp
Senior Member
If OP would format his/her query and carefully examine it, I guess it would become very obvious why the output isn't what's to be expected.
Re: please CHECK THE QUERY? [message #311375 is a reply to message #311325] Fri, 04 April 2008 05:14 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
If he would read through his old threads he would also know, since this one was answered less than a week ago.
Re: please CHECK THE QUERY? [message #311378 is a reply to message #311375] Fri, 04 April 2008 05:22 Go to previous messageGo to next message
MarcS
Messages: 312
Registered: March 2007
Location: Antwerp
Senior Member
Frank wrote on Fri, 04 April 2008 12:14
If he would read through his old threads he would also know, since this one was answered less than a week ago.


I'm not that omni-present and don't read all the threads all the time Smile

Guess the OP doesn't either Razz
Re: please CHECK THE QUERY? [message #311381 is a reply to message #311378] Fri, 04 April 2008 05:50 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
MarcS wrote on Fri, 04 April 2008 12:22

Guess the OP doesn't either Razz

lol
Re: please CHECK THE QUERY? [message #311423 is a reply to message #311295] Fri, 04 April 2008 08:07 Go to previous message
joy_division
Messages: 4641
Registered: February 2005
Location: East Coast USA
Senior Member
tondapi wrote on Fri, 04 April 2008 01:25

SUMMARY_DATE BETWEEN '01-Apr-'||TO_CHAR(SUMMARY_DATE,'YYYY')
AND
'31-Mar-'||(TO_CHAR(SUMMARY_DATE,'YYYY')+1)


WHAT CAN I DO FOR CORRECT DATA



Start by reading up on the difference between a character STRING and a DATE.
Previous Topic: Create a variable
Next Topic: can we use LIKE and BETWEEN same time
Goto Forum:
  


Current Time: Wed Dec 07 11:04:35 CST 2016

Total time taken to generate the page: 0.13510 seconds