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
 Other Forums
 Other Topics
 using sql statement in to_date function

Author  Topic 

poncho4u
Starting Member

3 Posts

Posted - 2013-11-26 : 11:25:46
Hi everyone,
Is it possible to use a complete sql statement within a to_date() function or an in() function?
Kindly let me know what is wrong with the query below:

(Select cell, sdate, PTTCH from stats_60
where ne = 'ATBSC7' and sdate = to_date('
SELECT SDATE FROM (
SELECT TO_CHAR(SDATE,'YYYY-MM-DD'), SDATE
, MAX(ROUND(ERLANG,2))over(partition by TO_CHAR(SDATE,'YYYY-MM-DD')) BHERL, ERLANG
FROM
(
SELECT A.ELEMENT, A.SDATE SDATE, TO_CHAR(A.SDATE,'HH24'), A.ERLANG
FROM STATS_LAYER_60 A
WHERE A.ELEMENT='ATBSC7'
AND TO_CHAR(A.SDATE,'HH24') BETWEEN '00' AND '24'
AND A.SDATE >= to_date('25/11/2013','DD/MM/YYYY')
AND A.SDATE < to_date('26/11/2013','DD/MM/YYYY')
)
) where BHERL=ERLANG','MM/DD/YYYY'
)

edit: moved to proper forum

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-11-26 : 12:56:31
What RDBMS are you using? This forum is for Microsoft SQL Server, so you might get better and faster answers at a generalized database forum if you are using another RDBMS.
Go to Top of Page

poncho4u
Starting Member

3 Posts

Posted - 2013-11-26 : 13:17:50
I am using Oracle 10i
quote:
Originally posted by James K

What RDBMS are you using? This forum is for Microsoft SQL Server, so you might get better and faster answers at a generalized database forum if you are using another RDBMS.

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-11-27 : 05:19:07
quote:
Originally posted by poncho4u

I am using Oracle 10i
quote:
Originally posted by James K

What RDBMS are you using? This forum is for Microsoft SQL Server, so you might get better and faster answers at a generalized database forum if you are using another RDBMS.




try your luck at www.dbforums.com
or at www.orafaq.com

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -