mahmed1
Well-known Member
- Joined
- Mar 28, 2009
- Messages
- 2,302
- Office Version
- 365
- 2016
- Platform
- Windows
Hiya guys,
Im hoping an SQL guru can help me
Im using Oracle.
I have a column with Date and Time in the database like
18/10/2016 08:00:36
How can i separate these into 2 columns and extract that and this SQL aint working because of the syntax - where am i going wrong?
Date Time
18/10/2016 08:00:36
I have used the to_date function to convert the string into dates but im struggling to put these in separate columns
SELECT USERID,
DATETIME,
To_date(DATETIME,'DD/MM/YYYY') as "MyDate",
To_char(DATETIME,'DD/MM/YYYY')
as "MyTime",
ACCOUNT,
COUNT(QUEUECOUNT)
FROM TABLE1
Where DATETIME >= To_date('18/10/2016 08:00:00,'DD/MM/YYYY HH24:MM:SS')
AND
DATETIME <= To_date('18/10/2016 23:59:59,'DD/MM/YYYY HH24:MM:SS')
GROUP BY
USERID,
DATETIME,
MyDate,
MyTime,
ACCOUNT,
Order By MyDate, MyTime
Im hoping an SQL guru can help me
Im using Oracle.
I have a column with Date and Time in the database like
18/10/2016 08:00:36
How can i separate these into 2 columns and extract that and this SQL aint working because of the syntax - where am i going wrong?
Date Time
18/10/2016 08:00:36
I have used the to_date function to convert the string into dates but im struggling to put these in separate columns
SELECT USERID,
DATETIME,
To_date(DATETIME,'DD/MM/YYYY') as "MyDate",
To_char(DATETIME,'DD/MM/YYYY')
as "MyTime",
ACCOUNT,
COUNT(QUEUECOUNT)
FROM TABLE1
Where DATETIME >= To_date('18/10/2016 08:00:00,'DD/MM/YYYY HH24:MM:SS')
AND
DATETIME <= To_date('18/10/2016 23:59:59,'DD/MM/YYYY HH24:MM:SS')
GROUP BY
USERID,
DATETIME,
MyDate,
MyTime,
ACCOUNT,
Order By MyDate, MyTime