DATETIME in Select
Posted in 1996
I am having trouble doing a very simple query using isql (SE V4.12) and
would gratefully appreciate any help or pointers ,
We have a table PATMISSF Patient Admission table that looks something like
admno char(8)
adate char(6) yymmdd
atime char(5) hh:mm
....
...<other fields clipped as not relevant here>
I am trying to get the interval from the admit date/time to given date.(say
current)
I tried the following SQL statement but ....it reports back with an error
1268: Invalid datetime or interval qualifier.
select admno,
adate[1,2]||"-"||adate[3,4]||"-"||adate[5,6]||" "||atime[1,5] adms ,
current Year to minute bif
from patmi1af
where adate = "961012"
INTO TEMP T1;
select aurno, bif - datetime(adms)
from t1
GENERAL QUESTION :-------------------------------------------------------------
Can the DATETIME function used in an expression be used in a SELECT
i.e
SELECT DATETIME(field1) - DATETIME(field2)
FROM atable....
where the fields are CHAR but in the DATETIME format eg CCYY-MM-DD HH:MM
it seems to accept literals (eg 1996-12-17 12:05 ) as the parameters for the
DATETIME but not char fields from a table as arguments.
? I could not find any reference to this restriction in the Manuals ...
HAs any one elsecome across it ..and if so how did they get around it ?
Thanks in advance
______________________
_______________________________| B.Raman |______
\\ Internet: | EDS NZ | /
\\ bsqlbp@mash.wnhealth.co.nz | Private Bag 7902. | /
)Voice: | Wellington 6001, N.Z | (
/ 04-385-5999 |______________________| \\
/_________________________________) (________\\